dockview-core 4.11.0 → 4.13.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 +5 -3
- package/dist/cjs/api/component.api.js +2 -2
- package/dist/cjs/api/dockviewGroupPanelApi.d.ts +3 -1
- package/dist/cjs/api/dockviewGroupPanelApi.js +24 -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/components/titlebar/tabs.d.ts +2 -2
- package/dist/cjs/dockview/components/titlebar/tabs.js +1 -1
- package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +3 -3
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts +10 -4
- package/dist/cjs/dockview/dockviewComponent.js +167 -85
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +2 -2
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +4 -1
- package/dist/cjs/dockview/dockviewPanel.d.ts +6 -4
- package/dist/cjs/dockview/dockviewPanel.js +12 -0
- package/dist/cjs/dockview/events.d.ts +4 -4
- package/dist/cjs/dockview/events.js +14 -14
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +7 -2
- package/dist/cjs/overlay/overlay.js +25 -14
- package/dist/cjs/splitview/splitview.js +2 -0
- package/dist/dockview-core.amd.js +172 -54
- 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 +172 -54
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +172 -54
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +172 -55
- 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 +172 -54
- 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 +172 -54
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/api/component.api.d.ts +5 -3
- package/dist/esm/api/component.api.js +2 -2
- package/dist/esm/api/dockviewGroupPanelApi.d.ts +3 -1
- package/dist/esm/api/dockviewGroupPanelApi.js +13 -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/components/titlebar/tabs.d.ts +2 -2
- package/dist/esm/dockview/components/titlebar/tabs.js +2 -2
- package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +3 -3
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +2 -2
- package/dist/esm/dockview/dockviewComponent.d.ts +10 -4
- package/dist/esm/dockview/dockviewComponent.js +99 -33
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +2 -2
- package/dist/esm/dockview/dockviewGroupPanelModel.js +5 -2
- package/dist/esm/dockview/dockviewPanel.d.ts +6 -4
- package/dist/esm/dockview/dockviewPanel.js +12 -0
- package/dist/esm/dockview/events.d.ts +4 -4
- package/dist/esm/dockview/events.js +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/overlay/overlay.js +26 -15
- package/dist/esm/splitview/splitview.js +2 -0
- package/package.json +1 -1
|
@@ -272,7 +272,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
272
272
|
// option only available when no panels in primary grid
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
|
-
_this._onWillShowOverlay.fire(new events_2.
|
|
275
|
+
_this._onWillShowOverlay.fire(new events_2.DockviewWillShowOverlayLocationEvent(event, {
|
|
276
276
|
kind: 'edge',
|
|
277
277
|
panel: undefined,
|
|
278
278
|
api: _this._api,
|
|
@@ -775,7 +775,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
775
775
|
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : constants_1.DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
|
|
776
776
|
var el = group.element.querySelector('.dv-void-container');
|
|
777
777
|
if (!el) {
|
|
778
|
-
throw new Error('failed to find drag handle');
|
|
778
|
+
throw new Error('dockview: failed to find drag handle');
|
|
779
779
|
}
|
|
780
780
|
overlay.setupDrag(el, {
|
|
781
781
|
inDragMode: typeof (options === null || options === void 0 ? void 0 : options.inDragMode) === 'boolean'
|
|
@@ -849,7 +849,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
849
849
|
case 'right':
|
|
850
850
|
return this.createGroupAtLocation([this.gridview.length], undefined, options); // insert into last position
|
|
851
851
|
default:
|
|
852
|
-
throw new Error("unsupported position ".concat(position));
|
|
852
|
+
throw new Error("dockview: unsupported position ".concat(position));
|
|
853
853
|
}
|
|
854
854
|
};
|
|
855
855
|
DockviewComponent.prototype.updateOptions = function (options) {
|
|
@@ -1030,27 +1030,70 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1030
1030
|
}
|
|
1031
1031
|
return result;
|
|
1032
1032
|
};
|
|
1033
|
-
DockviewComponent.prototype.fromJSON = function (data) {
|
|
1034
|
-
var e_6, _a, e_7, _b, e_8, _c, e_9, _d, e_10, _e, e_11, _f;
|
|
1033
|
+
DockviewComponent.prototype.fromJSON = function (data, options) {
|
|
1034
|
+
var e_6, _a, e_7, _b, e_8, _c, e_9, _d, e_10, _e, e_11, _f, e_12, _g;
|
|
1035
1035
|
var _this = this;
|
|
1036
|
-
var
|
|
1036
|
+
var _h, _j;
|
|
1037
|
+
var existingPanels = new Map();
|
|
1038
|
+
var tempGroup;
|
|
1039
|
+
if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
|
|
1040
|
+
/**
|
|
1041
|
+
* What are we doing here?
|
|
1042
|
+
*
|
|
1043
|
+
* 1. Create a temporary group to hold any panels that currently exist and that also exist in the new layout
|
|
1044
|
+
* 2. Remove that temporary group from the group mapping so that it doesn't get cleared when we clear the layout
|
|
1045
|
+
*/
|
|
1046
|
+
tempGroup = this.createGroup();
|
|
1047
|
+
this._groups.delete(tempGroup.api.id);
|
|
1048
|
+
var newPanels = Object.keys(data.panels);
|
|
1049
|
+
try {
|
|
1050
|
+
for (var _k = __values(this.panels), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
1051
|
+
var panel = _l.value;
|
|
1052
|
+
if (newPanels.includes(panel.api.id)) {
|
|
1053
|
+
existingPanels.set(panel.api.id, panel);
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1058
|
+
finally {
|
|
1059
|
+
try {
|
|
1060
|
+
if (_l && !_l.done && (_a = _k.return)) _a.call(_k);
|
|
1061
|
+
}
|
|
1062
|
+
finally { if (e_6) throw e_6.error; }
|
|
1063
|
+
}
|
|
1064
|
+
this.movingLock(function () {
|
|
1065
|
+
Array.from(existingPanels.values()).forEach(function (panel) {
|
|
1066
|
+
_this.moveGroupOrPanel({
|
|
1067
|
+
from: {
|
|
1068
|
+
groupId: panel.api.group.api.id,
|
|
1069
|
+
panelId: panel.api.id,
|
|
1070
|
+
},
|
|
1071
|
+
to: {
|
|
1072
|
+
group: tempGroup,
|
|
1073
|
+
position: 'center',
|
|
1074
|
+
},
|
|
1075
|
+
keepEmptyGroups: true,
|
|
1076
|
+
});
|
|
1077
|
+
});
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1037
1080
|
this.clear();
|
|
1038
1081
|
if (typeof data !== 'object' || data === null) {
|
|
1039
|
-
throw new Error('serialized layout must be a non-null object');
|
|
1082
|
+
throw new Error('dockview: serialized layout must be a non-null object');
|
|
1040
1083
|
}
|
|
1041
1084
|
var grid = data.grid, panels = data.panels, activeGroup = data.activeGroup;
|
|
1042
1085
|
if (grid.root.type !== 'branch' || !Array.isArray(grid.root.data)) {
|
|
1043
|
-
throw new Error('root must be of type branch');
|
|
1086
|
+
throw new Error('dockview: root must be of type branch');
|
|
1044
1087
|
}
|
|
1045
1088
|
try {
|
|
1046
1089
|
// take note of the existing dimensions
|
|
1047
1090
|
var width = this.width;
|
|
1048
1091
|
var height = this.height;
|
|
1049
1092
|
var createGroupFromSerializedState_1 = function (data) {
|
|
1050
|
-
var
|
|
1093
|
+
var e_13, _a;
|
|
1051
1094
|
var id = data.id, locked = data.locked, hideHeader = data.hideHeader, views = data.views, activeView = data.activeView;
|
|
1052
1095
|
if (typeof id !== 'string') {
|
|
1053
|
-
throw new Error('group id must be of type string');
|
|
1096
|
+
throw new Error('dockview: group id must be of type string');
|
|
1054
1097
|
}
|
|
1055
1098
|
var group = _this.createGroup({
|
|
1056
1099
|
id: id,
|
|
@@ -1059,33 +1102,60 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1059
1102
|
});
|
|
1060
1103
|
_this._onDidAddGroup.fire(group);
|
|
1061
1104
|
var createdPanels = [];
|
|
1105
|
+
var _loop_1 = function (child) {
|
|
1106
|
+
/**
|
|
1107
|
+
* Run the deserializer step seperately since this may fail to due corrupted external state.
|
|
1108
|
+
* In running this section first we avoid firing lots of 'add' events in the event of a failure
|
|
1109
|
+
* due to a corruption of input data.
|
|
1110
|
+
*/
|
|
1111
|
+
var existingPanel = existingPanels.get(child);
|
|
1112
|
+
if (tempGroup && existingPanel) {
|
|
1113
|
+
_this.movingLock(function () {
|
|
1114
|
+
tempGroup.model.removePanel(existingPanel);
|
|
1115
|
+
});
|
|
1116
|
+
createdPanels.push(existingPanel);
|
|
1117
|
+
existingPanel.updateFromStateModel(panels[child]);
|
|
1118
|
+
}
|
|
1119
|
+
else {
|
|
1120
|
+
var panel = _this._deserializer.fromJSON(panels[child], group);
|
|
1121
|
+
createdPanels.push(panel);
|
|
1122
|
+
}
|
|
1123
|
+
};
|
|
1062
1124
|
try {
|
|
1063
1125
|
for (var views_1 = __values(views), views_1_1 = views_1.next(); !views_1_1.done; views_1_1 = views_1.next()) {
|
|
1064
1126
|
var child = views_1_1.value;
|
|
1065
|
-
|
|
1066
|
-
* Run the deserializer step seperately since this may fail to due corrupted external state.
|
|
1067
|
-
* In running this section first we avoid firing lots of 'add' events in the event of a failure
|
|
1068
|
-
* due to a corruption of input data.
|
|
1069
|
-
*/
|
|
1070
|
-
var panel = _this._deserializer.fromJSON(panels[child], group);
|
|
1071
|
-
createdPanels.push(panel);
|
|
1127
|
+
_loop_1(child);
|
|
1072
1128
|
}
|
|
1073
1129
|
}
|
|
1074
|
-
catch (
|
|
1130
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
1075
1131
|
finally {
|
|
1076
1132
|
try {
|
|
1077
1133
|
if (views_1_1 && !views_1_1.done && (_a = views_1.return)) _a.call(views_1);
|
|
1078
1134
|
}
|
|
1079
|
-
finally { if (
|
|
1135
|
+
finally { if (e_13) throw e_13.error; }
|
|
1080
1136
|
}
|
|
1081
|
-
|
|
1137
|
+
var _loop_2 = function (i) {
|
|
1082
1138
|
var panel = createdPanels[i];
|
|
1083
1139
|
var isActive = typeof activeView === 'string' &&
|
|
1084
1140
|
activeView === panel.id;
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1141
|
+
var hasExisting = existingPanels.has(panel.api.id);
|
|
1142
|
+
if (hasExisting) {
|
|
1143
|
+
_this.movingLock(function () {
|
|
1144
|
+
group.model.openPanel(panel, {
|
|
1145
|
+
skipSetActive: !isActive,
|
|
1146
|
+
skipSetGroupActive: true,
|
|
1147
|
+
});
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
else {
|
|
1151
|
+
group.model.openPanel(panel, {
|
|
1152
|
+
skipSetActive: !isActive,
|
|
1153
|
+
skipSetGroupActive: true,
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
for (var i = 0; i < views.length; i++) {
|
|
1158
|
+
_loop_2(i);
|
|
1089
1159
|
}
|
|
1090
1160
|
if (!group.activePanel && group.panels.length > 0) {
|
|
1091
1161
|
group.model.openPanel(group.panels[group.panels.length - 1], {
|
|
@@ -1100,7 +1170,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1100
1170
|
},
|
|
1101
1171
|
});
|
|
1102
1172
|
this.layout(width, height, true);
|
|
1103
|
-
var serializedFloatingGroups = (
|
|
1173
|
+
var serializedFloatingGroups = (_h = data.floatingGroups) !== null && _h !== void 0 ? _h : [];
|
|
1104
1174
|
try {
|
|
1105
1175
|
for (var serializedFloatingGroups_1 = __values(serializedFloatingGroups), serializedFloatingGroups_1_1 = serializedFloatingGroups_1.next(); !serializedFloatingGroups_1_1.done; serializedFloatingGroups_1_1 = serializedFloatingGroups_1.next()) {
|
|
1106
1176
|
var serializedFloatingGroup = serializedFloatingGroups_1_1.value;
|
|
@@ -1115,14 +1185,14 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1115
1185
|
});
|
|
1116
1186
|
}
|
|
1117
1187
|
}
|
|
1118
|
-
catch (
|
|
1188
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1119
1189
|
finally {
|
|
1120
1190
|
try {
|
|
1121
|
-
if (serializedFloatingGroups_1_1 && !serializedFloatingGroups_1_1.done && (
|
|
1191
|
+
if (serializedFloatingGroups_1_1 && !serializedFloatingGroups_1_1.done && (_b = serializedFloatingGroups_1.return)) _b.call(serializedFloatingGroups_1);
|
|
1122
1192
|
}
|
|
1123
|
-
finally { if (
|
|
1193
|
+
finally { if (e_7) throw e_7.error; }
|
|
1124
1194
|
}
|
|
1125
|
-
var serializedPopoutGroups = (
|
|
1195
|
+
var serializedPopoutGroups = (_j = data.popoutGroups) !== null && _j !== void 0 ? _j : [];
|
|
1126
1196
|
// Create a promise that resolves when all popout groups are created
|
|
1127
1197
|
var popoutPromises_1 = [];
|
|
1128
1198
|
// Queue popup group creation with delays to avoid browser blocking
|
|
@@ -1134,7 +1204,9 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1134
1204
|
setTimeout(function () {
|
|
1135
1205
|
_this.addPopoutGroup(group, {
|
|
1136
1206
|
position: position !== null && position !== void 0 ? position : undefined,
|
|
1137
|
-
overridePopoutGroup: gridReferenceGroup
|
|
1207
|
+
overridePopoutGroup: gridReferenceGroup
|
|
1208
|
+
? group
|
|
1209
|
+
: undefined,
|
|
1138
1210
|
referenceGroup: gridReferenceGroup
|
|
1139
1211
|
? _this.getPanel(gridReferenceGroup)
|
|
1140
1212
|
: undefined,
|
|
@@ -1148,17 +1220,17 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1148
1220
|
// Store the promise for tests to wait on
|
|
1149
1221
|
this._popoutRestorationPromise = Promise.all(popoutPromises_1).then(function () { return void 0; });
|
|
1150
1222
|
try {
|
|
1151
|
-
for (var
|
|
1152
|
-
var floatingGroup =
|
|
1223
|
+
for (var _m = __values(this._floatingGroups), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
1224
|
+
var floatingGroup = _o.value;
|
|
1153
1225
|
floatingGroup.overlay.setBounds();
|
|
1154
1226
|
}
|
|
1155
1227
|
}
|
|
1156
|
-
catch (
|
|
1228
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1157
1229
|
finally {
|
|
1158
1230
|
try {
|
|
1159
|
-
if (
|
|
1231
|
+
if (_o && !_o.done && (_c = _m.return)) _c.call(_m);
|
|
1160
1232
|
}
|
|
1161
|
-
finally { if (
|
|
1233
|
+
finally { if (e_8) throw e_8.error; }
|
|
1162
1234
|
}
|
|
1163
1235
|
if (typeof activeGroup === 'string') {
|
|
1164
1236
|
var panel = this.getPanel(activeGroup);
|
|
@@ -1173,65 +1245,65 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1173
1245
|
/**
|
|
1174
1246
|
* Takes all the successfully created groups and remove all of their panels.
|
|
1175
1247
|
*/
|
|
1176
|
-
for (var
|
|
1177
|
-
var group =
|
|
1248
|
+
for (var _p = __values(this.groups), _q = _p.next(); !_q.done; _q = _p.next()) {
|
|
1249
|
+
var group = _q.value;
|
|
1178
1250
|
try {
|
|
1179
|
-
for (var
|
|
1180
|
-
var panel =
|
|
1251
|
+
for (var _r = (e_10 = void 0, __values(group.panels)), _s = _r.next(); !_s.done; _s = _r.next()) {
|
|
1252
|
+
var panel = _s.value;
|
|
1181
1253
|
this.removePanel(panel, {
|
|
1182
1254
|
removeEmptyGroup: false,
|
|
1183
1255
|
skipDispose: false,
|
|
1184
1256
|
});
|
|
1185
1257
|
}
|
|
1186
1258
|
}
|
|
1187
|
-
catch (
|
|
1259
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1188
1260
|
finally {
|
|
1189
1261
|
try {
|
|
1190
|
-
if (
|
|
1262
|
+
if (_s && !_s.done && (_e = _r.return)) _e.call(_r);
|
|
1191
1263
|
}
|
|
1192
|
-
finally { if (
|
|
1264
|
+
finally { if (e_10) throw e_10.error; }
|
|
1193
1265
|
}
|
|
1194
1266
|
}
|
|
1195
1267
|
}
|
|
1196
|
-
catch (
|
|
1268
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
1197
1269
|
finally {
|
|
1198
1270
|
try {
|
|
1199
|
-
if (
|
|
1271
|
+
if (_q && !_q.done && (_d = _p.return)) _d.call(_p);
|
|
1200
1272
|
}
|
|
1201
|
-
finally { if (
|
|
1273
|
+
finally { if (e_9) throw e_9.error; }
|
|
1202
1274
|
}
|
|
1203
1275
|
try {
|
|
1204
1276
|
/**
|
|
1205
1277
|
* To remove a group we cannot call this.removeGroup(...) since this makes assumptions about
|
|
1206
1278
|
* the underlying HTMLElement existing in the Gridview.
|
|
1207
1279
|
*/
|
|
1208
|
-
for (var
|
|
1209
|
-
var group =
|
|
1280
|
+
for (var _t = __values(this.groups), _u = _t.next(); !_u.done; _u = _t.next()) {
|
|
1281
|
+
var group = _u.value;
|
|
1210
1282
|
group.dispose();
|
|
1211
1283
|
this._groups.delete(group.id);
|
|
1212
1284
|
this._onDidRemoveGroup.fire(group);
|
|
1213
1285
|
}
|
|
1214
1286
|
}
|
|
1215
|
-
catch (
|
|
1287
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
1216
1288
|
finally {
|
|
1217
1289
|
try {
|
|
1218
|
-
if (
|
|
1290
|
+
if (_u && !_u.done && (_f = _t.return)) _f.call(_t);
|
|
1219
1291
|
}
|
|
1220
|
-
finally { if (
|
|
1292
|
+
finally { if (e_11) throw e_11.error; }
|
|
1221
1293
|
}
|
|
1222
1294
|
try {
|
|
1223
1295
|
// iterate over a reassigned array since original array will be modified
|
|
1224
|
-
for (var
|
|
1225
|
-
var floatingGroup =
|
|
1296
|
+
for (var _v = __values(__spreadArray([], __read(this._floatingGroups), false)), _w = _v.next(); !_w.done; _w = _v.next()) {
|
|
1297
|
+
var floatingGroup = _w.value;
|
|
1226
1298
|
floatingGroup.dispose();
|
|
1227
1299
|
}
|
|
1228
1300
|
}
|
|
1229
|
-
catch (
|
|
1301
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
1230
1302
|
finally {
|
|
1231
1303
|
try {
|
|
1232
|
-
if (
|
|
1304
|
+
if (_w && !_w.done && (_g = _v.return)) _g.call(_v);
|
|
1233
1305
|
}
|
|
1234
|
-
finally { if (
|
|
1306
|
+
finally { if (e_12) throw e_12.error; }
|
|
1235
1307
|
}
|
|
1236
1308
|
// fires clean-up events and clears the underlying HTML gridview.
|
|
1237
1309
|
this.clear();
|
|
@@ -1250,7 +1322,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1250
1322
|
this._onDidLayoutFromJSON.fire();
|
|
1251
1323
|
};
|
|
1252
1324
|
DockviewComponent.prototype.clear = function () {
|
|
1253
|
-
var
|
|
1325
|
+
var e_14, _a;
|
|
1254
1326
|
var groups = Array.from(this._groups.values()).map(function (_) { return _.value; });
|
|
1255
1327
|
var hasActiveGroup = !!this.activeGroup;
|
|
1256
1328
|
try {
|
|
@@ -1260,12 +1332,12 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1260
1332
|
this.removeGroup(group, { skipActive: true });
|
|
1261
1333
|
}
|
|
1262
1334
|
}
|
|
1263
|
-
catch (
|
|
1335
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
1264
1336
|
finally {
|
|
1265
1337
|
try {
|
|
1266
1338
|
if (groups_1_1 && !groups_1_1.done && (_a = groups_1.return)) _a.call(groups_1);
|
|
1267
1339
|
}
|
|
1268
|
-
finally { if (
|
|
1340
|
+
finally { if (e_14) throw e_14.error; }
|
|
1269
1341
|
}
|
|
1270
1342
|
if (hasActiveGroup) {
|
|
1271
1343
|
this.doSetGroupAndPanelActive(undefined);
|
|
@@ -1273,7 +1345,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1273
1345
|
this.gridview.clear();
|
|
1274
1346
|
};
|
|
1275
1347
|
DockviewComponent.prototype.closeAllGroups = function () {
|
|
1276
|
-
var
|
|
1348
|
+
var e_15, _a;
|
|
1277
1349
|
try {
|
|
1278
1350
|
for (var _b = __values(this._groups.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1279
1351
|
var entry = _c.value;
|
|
@@ -1281,22 +1353,22 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1281
1353
|
group.value.model.closeAllPanels();
|
|
1282
1354
|
}
|
|
1283
1355
|
}
|
|
1284
|
-
catch (
|
|
1356
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
1285
1357
|
finally {
|
|
1286
1358
|
try {
|
|
1287
1359
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1288
1360
|
}
|
|
1289
|
-
finally { if (
|
|
1361
|
+
finally { if (e_15) throw e_15.error; }
|
|
1290
1362
|
}
|
|
1291
1363
|
};
|
|
1292
1364
|
DockviewComponent.prototype.addPanel = function (options) {
|
|
1293
1365
|
var _a, _b;
|
|
1294
1366
|
if (this.panels.find(function (_) { return _.id === options.id; })) {
|
|
1295
|
-
throw new Error("panel with id ".concat(options.id, " already exists"));
|
|
1367
|
+
throw new Error("dockview: panel with id ".concat(options.id, " already exists"));
|
|
1296
1368
|
}
|
|
1297
1369
|
var referenceGroup;
|
|
1298
1370
|
if (options.position && options.floating) {
|
|
1299
|
-
throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
|
|
1371
|
+
throw new Error('dockview: you can only provide one of: position, floating as arguments to .addPanel(...)');
|
|
1300
1372
|
}
|
|
1301
1373
|
var initial = {
|
|
1302
1374
|
width: options.initialWidth,
|
|
@@ -1310,7 +1382,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1310
1382
|
: options.position.referencePanel;
|
|
1311
1383
|
index = options.position.index;
|
|
1312
1384
|
if (!referencePanel) {
|
|
1313
|
-
throw new Error("referencePanel '".concat(options.position.referencePanel, "' does not exist"));
|
|
1385
|
+
throw new Error("dockview: referencePanel '".concat(options.position.referencePanel, "' does not exist"));
|
|
1314
1386
|
}
|
|
1315
1387
|
referenceGroup = this.findGroup(referencePanel);
|
|
1316
1388
|
}
|
|
@@ -1321,7 +1393,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1321
1393
|
: options.position.referenceGroup;
|
|
1322
1394
|
index = options.position.index;
|
|
1323
1395
|
if (!referenceGroup) {
|
|
1324
|
-
throw new Error("referenceGroup '".concat(options.position.referenceGroup, "' does not exist"));
|
|
1396
|
+
throw new Error("dockview: referenceGroup '".concat(options.position.referenceGroup, "' does not exist"));
|
|
1325
1397
|
}
|
|
1326
1398
|
}
|
|
1327
1399
|
else {
|
|
@@ -1434,7 +1506,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1434
1506
|
}; }
|
|
1435
1507
|
var group = panel.group;
|
|
1436
1508
|
if (!group) {
|
|
1437
|
-
throw new Error("cannot remove panel ".concat(panel.id, ". it's missing a group."));
|
|
1509
|
+
throw new Error("dockview: cannot remove panel ".concat(panel.id, ". it's missing a group."));
|
|
1438
1510
|
}
|
|
1439
1511
|
group.model.removePanel(panel, {
|
|
1440
1512
|
skipSetActiveGroup: options.skipSetActiveGroup,
|
|
@@ -1483,11 +1555,11 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1483
1555
|
? this.panels.find(function (panel) { return panel.id === options.referencePanel; })
|
|
1484
1556
|
: options.referencePanel;
|
|
1485
1557
|
if (!referencePanel) {
|
|
1486
|
-
throw new Error("reference panel ".concat(options.referencePanel, " does not exist"));
|
|
1558
|
+
throw new Error("dockview: reference panel ".concat(options.referencePanel, " does not exist"));
|
|
1487
1559
|
}
|
|
1488
1560
|
referenceGroup = this.findGroup(referencePanel);
|
|
1489
1561
|
if (!referenceGroup) {
|
|
1490
|
-
throw new Error("reference group for reference panel ".concat(options.referencePanel, " does not exist"));
|
|
1562
|
+
throw new Error("dockview: reference group for reference panel ".concat(options.referencePanel, " does not exist"));
|
|
1491
1563
|
}
|
|
1492
1564
|
}
|
|
1493
1565
|
else if ((0, options_1.isGroupOptionsWithGroup)(options)) {
|
|
@@ -1496,7 +1568,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1496
1568
|
? (_a = this._groups.get(options.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
|
|
1497
1569
|
: options.referenceGroup;
|
|
1498
1570
|
if (!referenceGroup) {
|
|
1499
|
-
throw new Error("reference group ".concat(options.referenceGroup, " does not exist"));
|
|
1571
|
+
throw new Error("dockview: reference group ".concat(options.referenceGroup, " does not exist"));
|
|
1500
1572
|
}
|
|
1501
1573
|
}
|
|
1502
1574
|
else {
|
|
@@ -1537,7 +1609,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1537
1609
|
this.doRemoveGroup(group, options);
|
|
1538
1610
|
};
|
|
1539
1611
|
DockviewComponent.prototype.doRemoveGroup = function (group, options) {
|
|
1540
|
-
var
|
|
1612
|
+
var e_16, _a;
|
|
1541
1613
|
var _b;
|
|
1542
1614
|
var panels = __spreadArray([], __read(group.panels), false); // reassign since group panels will mutate
|
|
1543
1615
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
@@ -1550,12 +1622,12 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1550
1622
|
});
|
|
1551
1623
|
}
|
|
1552
1624
|
}
|
|
1553
|
-
catch (
|
|
1625
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
1554
1626
|
finally {
|
|
1555
1627
|
try {
|
|
1556
1628
|
if (panels_1_1 && !panels_1_1.done && (_a = panels_1.return)) _a.call(panels_1);
|
|
1557
1629
|
}
|
|
1558
|
-
finally { if (
|
|
1630
|
+
finally { if (e_16) throw e_16.error; }
|
|
1559
1631
|
}
|
|
1560
1632
|
}
|
|
1561
1633
|
var activePanel = this.activePanel;
|
|
@@ -1575,7 +1647,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1575
1647
|
}
|
|
1576
1648
|
return floatingGroup.group;
|
|
1577
1649
|
}
|
|
1578
|
-
throw new Error('failed to find floating group');
|
|
1650
|
+
throw new Error('dockview: failed to find floating group');
|
|
1579
1651
|
}
|
|
1580
1652
|
if (group.api.location.type === 'popout') {
|
|
1581
1653
|
var selectedGroup = this._popoutGroups.find(function (_) { return _.popoutGroup === group; });
|
|
@@ -1606,7 +1678,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1606
1678
|
this.updateWatermark();
|
|
1607
1679
|
return selectedGroup.popoutGroup;
|
|
1608
1680
|
}
|
|
1609
|
-
throw new Error('failed to find popout group');
|
|
1681
|
+
throw new Error('dockview: failed to find popout group');
|
|
1610
1682
|
}
|
|
1611
1683
|
var re = _super.prototype.doRemoveGroup.call(this, group, options);
|
|
1612
1684
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
|
|
@@ -1638,7 +1710,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1638
1710
|
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
1639
1711
|
: undefined;
|
|
1640
1712
|
if (!sourceGroup) {
|
|
1641
|
-
throw new Error("Failed to find group id ".concat(sourceGroupId));
|
|
1713
|
+
throw new Error("dockview: Failed to find group id ".concat(sourceGroupId));
|
|
1642
1714
|
}
|
|
1643
1715
|
if (sourceItemId === undefined) {
|
|
1644
1716
|
/**
|
|
@@ -1665,9 +1737,9 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1665
1737
|
});
|
|
1666
1738
|
});
|
|
1667
1739
|
if (!removedPanel_1) {
|
|
1668
|
-
throw new Error("No panel with id ".concat(sourceItemId));
|
|
1740
|
+
throw new Error("dockview: No panel with id ".concat(sourceItemId));
|
|
1669
1741
|
}
|
|
1670
|
-
if (sourceGroup.model.size === 0) {
|
|
1742
|
+
if (!options.keepEmptyGroups && sourceGroup.model.size === 0) {
|
|
1671
1743
|
// remove the group and do not set a new group as active
|
|
1672
1744
|
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
1673
1745
|
}
|
|
@@ -1677,7 +1749,8 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1677
1749
|
var _a;
|
|
1678
1750
|
return destinationGroup.model.openPanel(removedPanel_1, {
|
|
1679
1751
|
index: destinationIndex,
|
|
1680
|
-
skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) &&
|
|
1752
|
+
skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) &&
|
|
1753
|
+
!isDestinationGroupEmpty_1,
|
|
1681
1754
|
skipSetGroupActive: true,
|
|
1682
1755
|
});
|
|
1683
1756
|
});
|
|
@@ -1688,6 +1761,13 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1688
1761
|
panel: removedPanel_1,
|
|
1689
1762
|
from: sourceGroup,
|
|
1690
1763
|
});
|
|
1764
|
+
/**
|
|
1765
|
+
* Update overlay positions after DOM layout completes to prevent 0×0 dimensions.
|
|
1766
|
+
* With defaultRenderer="always" this results in panel content not showing after move operations.
|
|
1767
|
+
*/
|
|
1768
|
+
requestAnimationFrame(function () {
|
|
1769
|
+
_this.overlayRenderContainer.updateAllPositions();
|
|
1770
|
+
});
|
|
1691
1771
|
}
|
|
1692
1772
|
else {
|
|
1693
1773
|
/**
|
|
@@ -1735,7 +1815,9 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1735
1815
|
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
1736
1816
|
var newGroup_1 = this.createGroupAtLocation(targetLocation);
|
|
1737
1817
|
this.movingLock(function () {
|
|
1738
|
-
return newGroup_1.model.openPanel(removedPanel_2
|
|
1818
|
+
return newGroup_1.model.openPanel(removedPanel_2, {
|
|
1819
|
+
skipSetActive: true,
|
|
1820
|
+
});
|
|
1739
1821
|
});
|
|
1740
1822
|
this.doSetGroupAndPanelActive(newGroup_1);
|
|
1741
1823
|
this._onDidMovePanel.fire({
|
|
@@ -1773,7 +1855,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1773
1855
|
});
|
|
1774
1856
|
});
|
|
1775
1857
|
if (!removedPanel_3) {
|
|
1776
|
-
throw new Error("No panel with id ".concat(sourceItemId));
|
|
1858
|
+
throw new Error("dockview: No panel with id ".concat(sourceItemId));
|
|
1777
1859
|
}
|
|
1778
1860
|
var dropLocation = (0, gridview_1.getRelativeLocation)(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
1779
1861
|
var group_2 = this.createGroupAtLocation(dropLocation);
|
|
@@ -1808,7 +1890,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1808
1890
|
this.doRemoveGroup(from, { skipActive: true });
|
|
1809
1891
|
}
|
|
1810
1892
|
this.movingLock(function () {
|
|
1811
|
-
var
|
|
1893
|
+
var e_17, _a;
|
|
1812
1894
|
try {
|
|
1813
1895
|
for (var panels_3 = __values(panels_2), panels_3_1 = panels_3.next(); !panels_3_1.done; panels_3_1 = panels_3.next()) {
|
|
1814
1896
|
var panel = panels_3_1.value;
|
|
@@ -1818,12 +1900,12 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1818
1900
|
});
|
|
1819
1901
|
}
|
|
1820
1902
|
}
|
|
1821
|
-
catch (
|
|
1903
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
1822
1904
|
finally {
|
|
1823
1905
|
try {
|
|
1824
1906
|
if (panels_3_1 && !panels_3_1.done && (_a = panels_3.return)) _a.call(panels_3);
|
|
1825
1907
|
}
|
|
1826
|
-
finally { if (
|
|
1908
|
+
finally { if (e_17) throw e_17.error; }
|
|
1827
1909
|
}
|
|
1828
1910
|
});
|
|
1829
1911
|
// Ensure group becomes active after move
|
|
@@ -1846,7 +1928,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1846
1928
|
case 'floating': {
|
|
1847
1929
|
var selectedFloatingGroup = this._floatingGroups.find(function (x) { return x.group === from; });
|
|
1848
1930
|
if (!selectedFloatingGroup) {
|
|
1849
|
-
throw new Error('failed to find floating group');
|
|
1931
|
+
throw new Error('dockview: failed to find floating group');
|
|
1850
1932
|
}
|
|
1851
1933
|
selectedFloatingGroup.dispose();
|
|
1852
1934
|
break;
|
|
@@ -1854,7 +1936,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1854
1936
|
case 'popout': {
|
|
1855
1937
|
var selectedPopoutGroup = this._popoutGroups.find(function (x) { return x.popoutGroup === from; });
|
|
1856
1938
|
if (!selectedPopoutGroup) {
|
|
1857
|
-
throw new Error('failed to find popout group');
|
|
1939
|
+
throw new Error('dockview: failed to find popout group');
|
|
1858
1940
|
}
|
|
1859
1941
|
// Remove from popout groups list to prevent automatic restoration
|
|
1860
1942
|
var index = this._popoutGroups.indexOf(selectedPopoutGroup);
|
|
@@ -3,7 +3,7 @@ import { PanelTransfer } from '../dnd/dataTransfer';
|
|
|
3
3
|
import { Position } from '../dnd/droptarget';
|
|
4
4
|
import { DockviewComponent } from './dockviewComponent';
|
|
5
5
|
import { DockviewEvent, Event } from '../events';
|
|
6
|
-
import { DockviewGroupDropLocation,
|
|
6
|
+
import { DockviewGroupDropLocation, DockviewWillShowOverlayLocationEvent } from './events';
|
|
7
7
|
import { IViewSize } from '../gridview/gridview';
|
|
8
8
|
import { CompositeDisposable } from '../lifecycle';
|
|
9
9
|
import { IPanel, PanelInitParameters, PanelUpdateEvent, Parameters } from '../panel/types';
|
|
@@ -155,7 +155,7 @@ export declare class DockviewGroupPanelModel extends CompositeDisposable impleme
|
|
|
155
155
|
private readonly _onWillDrop;
|
|
156
156
|
readonly onWillDrop: Event<DockviewWillDropEvent>;
|
|
157
157
|
private readonly _onWillShowOverlay;
|
|
158
|
-
readonly onWillShowOverlay: Event<
|
|
158
|
+
readonly onWillShowOverlay: Event<DockviewWillShowOverlayLocationEvent>;
|
|
159
159
|
private readonly _onTabDragStart;
|
|
160
160
|
readonly onTabDragStart: Event<TabDragEvent>;
|
|
161
161
|
private readonly _onGroupDragStart;
|
|
@@ -194,7 +194,7 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
194
194
|
}), _this.tabsContainer.onWillShowOverlay(function (event) {
|
|
195
195
|
_this._onWillShowOverlay.fire(event);
|
|
196
196
|
}), _this.contentContainer.dropTarget.onWillShowOverlay(function (event) {
|
|
197
|
-
_this._onWillShowOverlay.fire(new events_2.
|
|
197
|
+
_this._onWillShowOverlay.fire(new events_2.DockviewWillShowOverlayLocationEvent(event, {
|
|
198
198
|
kind: 'content',
|
|
199
199
|
panel: _this.activePanel,
|
|
200
200
|
api: _this._api,
|
|
@@ -651,8 +651,11 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
651
651
|
this._activePanel = panel;
|
|
652
652
|
if (panel) {
|
|
653
653
|
this.tabsContainer.setActivePanel(panel);
|
|
654
|
+
this.contentContainer.openPanel(panel);
|
|
654
655
|
panel.layout(this._width, this._height);
|
|
655
656
|
this.updateMru(panel);
|
|
657
|
+
// Refresh focus state to handle programmatic activation without DOM focus change
|
|
658
|
+
this.contentContainer.refreshFocusState();
|
|
656
659
|
this._onDidActivePanelChange.fire({
|
|
657
660
|
panel: panel,
|
|
658
661
|
});
|
|
@@ -21,6 +21,7 @@ export interface IDockviewPanel extends IDisposable, IPanel {
|
|
|
21
21
|
updateParentGroup(group: DockviewGroupPanel, options?: {
|
|
22
22
|
skipSetActive?: boolean;
|
|
23
23
|
}): void;
|
|
24
|
+
updateFromStateModel(state: GroupviewPanelState): void;
|
|
24
25
|
init(params: IGroupPanelInitParameters): void;
|
|
25
26
|
toJSON(): GroupviewPanelState;
|
|
26
27
|
setTitle(title: string): void;
|
|
@@ -37,10 +38,10 @@ export declare class DockviewPanel extends CompositeDisposable implements IDockv
|
|
|
37
38
|
private _params?;
|
|
38
39
|
private _title;
|
|
39
40
|
private _renderer;
|
|
40
|
-
private
|
|
41
|
-
private
|
|
42
|
-
private
|
|
43
|
-
private
|
|
41
|
+
private _minimumWidth;
|
|
42
|
+
private _minimumHeight;
|
|
43
|
+
private _maximumWidth;
|
|
44
|
+
private _maximumHeight;
|
|
44
45
|
get params(): Parameters | undefined;
|
|
45
46
|
get title(): string | undefined;
|
|
46
47
|
get group(): DockviewGroupPanel;
|
|
@@ -58,6 +59,7 @@ export declare class DockviewPanel extends CompositeDisposable implements IDockv
|
|
|
58
59
|
setTitle(title: string): void;
|
|
59
60
|
setRenderer(renderer: DockviewPanelRenderer): void;
|
|
60
61
|
update(event: PanelUpdateEvent): void;
|
|
62
|
+
updateFromStateModel(state: GroupviewPanelState): void;
|
|
61
63
|
updateParentGroup(group: DockviewGroupPanel, options?: {
|
|
62
64
|
skipSetActive?: boolean;
|
|
63
65
|
}): void;
|