dockview 1.0.1 → 1.1.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 +243 -186
- package/dist/cjs/api/component.api.d.ts +32 -17
- package/dist/cjs/api/component.api.js +155 -28
- package/dist/cjs/api/component.api.js.map +1 -1
- package/dist/cjs/api/gridviewPanelApi.js +1 -0
- package/dist/cjs/api/gridviewPanelApi.js.map +1 -1
- package/dist/cjs/api/groupPanelApi.d.ts +11 -14
- package/dist/cjs/api/groupPanelApi.js +19 -17
- package/dist/cjs/api/groupPanelApi.js.map +1 -1
- package/dist/cjs/api/panelApi.d.ts +0 -25
- package/dist/cjs/api/panelApi.js +1 -20
- package/dist/cjs/api/panelApi.js.map +1 -1
- package/dist/cjs/api/paneviewPanelApi.js +1 -0
- package/dist/cjs/api/paneviewPanelApi.js.map +1 -1
- package/dist/cjs/api/splitviewPanelApi.d.ts +0 -1
- package/dist/cjs/api/splitviewPanelApi.js +1 -5
- package/dist/cjs/api/splitviewPanelApi.js.map +1 -1
- package/dist/cjs/dnd/abstractDragHandler.d.ts +3 -3
- package/dist/cjs/dnd/abstractDragHandler.js +15 -14
- package/dist/cjs/dnd/abstractDragHandler.js.map +1 -1
- package/dist/cjs/dnd/dataTransfer.d.ts +0 -25
- package/dist/cjs/dnd/dataTransfer.js +1 -45
- package/dist/cjs/dnd/dataTransfer.js.map +1 -1
- package/dist/cjs/dnd/dnd.d.ts +1 -14
- package/dist/cjs/dnd/dnd.js +1 -79
- package/dist/cjs/dnd/dnd.js.map +1 -1
- package/dist/cjs/dnd/droptarget.d.ts +4 -5
- package/dist/cjs/dnd/droptarget.js +70 -46
- package/dist/cjs/dnd/droptarget.js.map +1 -1
- package/dist/cjs/dockview/components/tab/defaultTab.d.ts +0 -1
- package/dist/cjs/dockview/components/tab/defaultTab.js +0 -8
- package/dist/cjs/dockview/components/tab/defaultTab.js.map +1 -1
- package/dist/cjs/dockview/defaultGroupPanelView.js +3 -1
- package/dist/cjs/dockview/defaultGroupPanelView.js.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts +27 -19
- package/dist/cjs/dockview/dockviewComponent.js +67 -178
- package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanel.d.ts +2 -5
- package/dist/cjs/dockview/dockviewGroupPanel.js +2 -31
- package/dist/cjs/dockview/dockviewGroupPanel.js.map +1 -1
- package/dist/cjs/dockview/options.d.ts +2 -1
- package/dist/cjs/events.d.ts +7 -0
- package/dist/cjs/events.js +47 -5
- package/dist/cjs/events.js.map +1 -1
- package/dist/cjs/gridview/baseComponentGridview.d.ts +9 -0
- package/dist/cjs/gridview/baseComponentGridview.js +20 -15
- package/dist/cjs/gridview/baseComponentGridview.js.map +1 -1
- package/dist/cjs/gridview/basePanelView.d.ts +5 -8
- package/dist/cjs/gridview/basePanelView.js +14 -8
- package/dist/cjs/gridview/basePanelView.js.map +1 -1
- package/dist/cjs/gridview/branchNode.js +1 -1
- package/dist/cjs/gridview/branchNode.js.map +1 -1
- package/dist/cjs/gridview/gridview.js +19 -18
- package/dist/cjs/gridview/gridview.js.map +1 -1
- package/dist/cjs/gridview/gridviewComponent.d.ts +4 -0
- package/dist/cjs/gridview/gridviewComponent.js +5 -0
- package/dist/cjs/gridview/gridviewComponent.js.map +1 -1
- package/dist/cjs/gridview/gridviewPanel.d.ts +0 -1
- package/dist/cjs/gridview/gridviewPanel.js +3 -6
- package/dist/cjs/gridview/gridviewPanel.js.map +1 -1
- package/dist/cjs/gridview/leafNode.js +1 -0
- package/dist/cjs/gridview/leafNode.js.map +1 -1
- package/dist/cjs/groupview/groupPanel.d.ts +0 -7
- package/dist/cjs/groupview/groupview.d.ts +15 -8
- package/dist/cjs/groupview/groupview.js +38 -125
- package/dist/cjs/groupview/groupview.js.map +1 -1
- package/dist/cjs/groupview/groupviewPanel.d.ts +5 -2
- package/dist/cjs/groupview/groupviewPanel.js.map +1 -1
- package/dist/cjs/groupview/panel/content.js +1 -0
- package/dist/cjs/groupview/panel/content.js.map +1 -1
- package/dist/cjs/groupview/tab.d.ts +10 -13
- package/dist/cjs/groupview/tab.js +22 -80
- package/dist/cjs/groupview/tab.js.map +1 -1
- package/dist/cjs/groupview/titlebar/tabsContainer.js +6 -8
- package/dist/cjs/groupview/titlebar/tabsContainer.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/lifecycle.js +2 -1
- package/dist/cjs/lifecycle.js.map +1 -1
- package/dist/cjs/panel/types.d.ts +0 -2
- package/dist/cjs/paneview/draggablePaneviewPanel.d.ts +2 -2
- package/dist/cjs/paneview/draggablePaneviewPanel.js +32 -29
- package/dist/cjs/paneview/draggablePaneviewPanel.js.map +1 -1
- package/dist/cjs/paneview/paneview.d.ts +1 -1
- package/dist/cjs/paneview/paneview.js +2 -5
- package/dist/cjs/paneview/paneview.js.map +1 -1
- package/dist/cjs/paneview/paneviewComponent.d.ts +6 -5
- package/dist/cjs/paneview/paneviewComponent.js +11 -16
- package/dist/cjs/paneview/paneviewComponent.js.map +1 -1
- package/dist/cjs/paneview/paneviewPanel.d.ts +5 -1
- package/dist/cjs/paneview/paneviewPanel.js +14 -2
- package/dist/cjs/paneview/paneviewPanel.js.map +1 -1
- package/dist/cjs/react/deserializer.js +1 -3
- package/dist/cjs/react/deserializer.js.map +1 -1
- package/dist/cjs/react/dockview/dockview.d.ts +9 -9
- package/dist/cjs/react/dockview/dockview.js +14 -1
- package/dist/cjs/react/dockview/dockview.js.map +1 -1
- package/dist/cjs/react/dockview/reactContentPart.js +4 -4
- package/dist/cjs/react/dockview/reactContentPart.js.map +1 -1
- package/dist/cjs/react/dockview/reactHeaderPart.js +1 -0
- package/dist/cjs/react/dockview/reactHeaderPart.js.map +1 -1
- package/dist/cjs/react/dockview/reactWatermarkPart.d.ts +1 -2
- package/dist/cjs/react/dockview/reactWatermarkPart.js +1 -2
- package/dist/cjs/react/dockview/reactWatermarkPart.js.map +1 -1
- package/dist/cjs/react/gridview/view.js +2 -2
- package/dist/cjs/react/gridview/view.js.map +1 -1
- package/dist/cjs/react/index.d.ts +1 -0
- package/dist/cjs/react/index.js.map +1 -1
- package/dist/cjs/react/react.js +1 -2
- package/dist/cjs/react/react.js.map +1 -1
- package/dist/cjs/react/splitview/view.js +2 -2
- package/dist/cjs/react/splitview/view.js.map +1 -1
- package/dist/cjs/splitview/core/splitview.js +1 -1
- package/dist/cjs/splitview/core/splitview.js.map +1 -1
- package/dist/cjs/splitview/splitviewComponent.d.ts +9 -6
- package/dist/cjs/splitview/splitviewComponent.js +11 -1
- package/dist/cjs/splitview/splitviewComponent.js.map +1 -1
- package/dist/cjs/splitview/splitviewPanel.d.ts +1 -6
- package/dist/cjs/splitview/splitviewPanel.js +5 -3
- package/dist/cjs/splitview/splitviewPanel.js.map +1 -1
- package/dist/dockview.amd.js +480 -567
- package/dist/dockview.amd.min.js +2 -16
- package/dist/dockview.amd.min.noStyle.js +2 -16
- package/dist/dockview.amd.noStyle.js +479 -566
- package/dist/dockview.cjs.js +480 -567
- package/dist/dockview.esm.js +480 -563
- package/dist/dockview.esm.min.js +2 -16
- package/dist/dockview.js +480 -567
- package/dist/dockview.min.js +2 -16
- package/dist/dockview.min.noStyle.js +2 -16
- package/dist/dockview.noStyle.js +479 -566
- package/dist/esm/api/component.api.d.ts +32 -17
- package/dist/esm/api/component.api.js +71 -20
- package/dist/esm/api/gridviewPanelApi.js +1 -0
- package/dist/esm/api/groupPanelApi.d.ts +11 -14
- package/dist/esm/api/groupPanelApi.js +18 -13
- package/dist/esm/api/panelApi.d.ts +0 -25
- package/dist/esm/api/panelApi.js +1 -20
- package/dist/esm/api/paneviewPanelApi.js +1 -0
- package/dist/esm/api/splitviewPanelApi.d.ts +0 -1
- package/dist/esm/api/splitviewPanelApi.js +1 -5
- package/dist/esm/dnd/abstractDragHandler.d.ts +3 -3
- package/dist/esm/dnd/abstractDragHandler.js +9 -8
- package/dist/esm/dnd/dataTransfer.d.ts +0 -25
- package/dist/esm/dnd/dataTransfer.js +0 -40
- package/dist/esm/dnd/dnd.d.ts +1 -14
- package/dist/esm/dnd/dnd.js +1 -69
- package/dist/esm/dnd/droptarget.d.ts +4 -5
- package/dist/esm/dnd/droptarget.js +70 -46
- package/dist/esm/dockview/components/tab/defaultTab.d.ts +0 -1
- package/dist/esm/dockview/components/tab/defaultTab.js +1 -9
- package/dist/esm/dockview/defaultGroupPanelView.js +3 -1
- package/dist/esm/dockview/dockviewComponent.d.ts +27 -19
- package/dist/esm/dockview/dockviewComponent.js +54 -118
- package/dist/esm/dockview/dockviewGroupPanel.d.ts +2 -5
- package/dist/esm/dockview/dockviewGroupPanel.js +2 -30
- package/dist/esm/dockview/options.d.ts +2 -1
- package/dist/esm/events.d.ts +7 -0
- package/dist/esm/events.js +20 -3
- package/dist/esm/gridview/baseComponentGridview.d.ts +9 -0
- package/dist/esm/gridview/baseComponentGridview.js +21 -16
- package/dist/esm/gridview/basePanelView.d.ts +5 -8
- package/dist/esm/gridview/basePanelView.js +10 -8
- package/dist/esm/gridview/branchNode.js +1 -1
- package/dist/esm/gridview/gridview.js +16 -16
- package/dist/esm/gridview/gridviewComponent.d.ts +4 -0
- package/dist/esm/gridview/gridviewComponent.js +5 -0
- package/dist/esm/gridview/gridviewPanel.d.ts +0 -1
- package/dist/esm/gridview/gridviewPanel.js +3 -6
- package/dist/esm/gridview/leafNode.js +1 -0
- package/dist/esm/groupview/groupPanel.d.ts +0 -7
- package/dist/esm/groupview/groupview.d.ts +15 -8
- package/dist/esm/groupview/groupview.js +24 -58
- package/dist/esm/groupview/groupviewPanel.d.ts +5 -2
- package/dist/esm/groupview/panel/content.js +1 -0
- package/dist/esm/groupview/tab.d.ts +10 -13
- package/dist/esm/groupview/tab.js +17 -24
- package/dist/esm/groupview/titlebar/tabsContainer.js +6 -8
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/lifecycle.js +2 -1
- package/dist/esm/panel/types.d.ts +0 -2
- package/dist/esm/paneview/draggablePaneviewPanel.d.ts +2 -2
- package/dist/esm/paneview/draggablePaneviewPanel.js +32 -29
- package/dist/esm/paneview/paneview.d.ts +1 -1
- package/dist/esm/paneview/paneview.js +2 -5
- package/dist/esm/paneview/paneviewComponent.d.ts +6 -5
- package/dist/esm/paneview/paneviewComponent.js +11 -8
- package/dist/esm/paneview/paneviewPanel.d.ts +5 -1
- package/dist/esm/paneview/paneviewPanel.js +10 -2
- package/dist/esm/react/deserializer.js +1 -3
- package/dist/esm/react/dockview/dockview.d.ts +9 -9
- package/dist/esm/react/dockview/dockview.js +15 -2
- package/dist/esm/react/dockview/reactContentPart.js +4 -4
- package/dist/esm/react/dockview/reactHeaderPart.js +1 -0
- package/dist/esm/react/dockview/reactWatermarkPart.d.ts +1 -2
- package/dist/esm/react/dockview/reactWatermarkPart.js +1 -2
- package/dist/esm/react/gridview/view.js +2 -2
- package/dist/esm/react/index.d.ts +1 -0
- package/dist/esm/react/react.js +1 -2
- package/dist/esm/react/splitview/view.js +2 -2
- package/dist/esm/splitview/core/splitview.js +1 -1
- package/dist/esm/splitview/splitviewComponent.d.ts +9 -6
- package/dist/esm/splitview/splitviewComponent.js +10 -2
- package/dist/esm/splitview/splitviewPanel.d.ts +1 -6
- package/dist/esm/splitview/splitviewPanel.js +5 -3
- package/dist/styles/dockview.css +5 -9
- package/package.json +4 -4
- package/dist/cjs/functions.d.ts +0 -1
- package/dist/cjs/functions.js +0 -42
- package/dist/cjs/functions.js.map +0 -1
- package/dist/cjs/groupview/panel/hostedPanel.d.ts +0 -22
- package/dist/cjs/groupview/panel/hostedPanel.js +0 -57
- package/dist/cjs/groupview/panel/hostedPanel.js.map +0 -1
- package/dist/cjs/json.d.ts +0 -1
- package/dist/cjs/json.js +0 -14
- package/dist/cjs/json.js.map +0 -1
- package/dist/esm/functions.d.ts +0 -1
- package/dist/esm/functions.js +0 -8
- package/dist/esm/groupview/panel/hostedPanel.d.ts +0 -22
- package/dist/esm/groupview/panel/hostedPanel.js +0 -43
- package/dist/esm/json.d.ts +0 -1
- package/dist/esm/json.js +0 -9
package/dist/dockview.noStyle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 1.0
|
|
3
|
+
* @version 1.1.0
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) && this._last !== undefined) {
|
|
62
62
|
listener(this._last);
|
|
63
63
|
}
|
|
64
|
-
this._listeners.length === 0;
|
|
65
64
|
this._listeners.push(listener);
|
|
66
65
|
return {
|
|
67
66
|
dispose: () => {
|
|
@@ -77,9 +76,9 @@
|
|
|
77
76
|
}
|
|
78
77
|
fire(e) {
|
|
79
78
|
this._last = e;
|
|
80
|
-
this._listeners
|
|
79
|
+
for (const listener of this._listeners) {
|
|
81
80
|
listener(e);
|
|
82
|
-
}
|
|
81
|
+
}
|
|
83
82
|
}
|
|
84
83
|
dispose() {
|
|
85
84
|
this._listeners = [];
|
|
@@ -101,6 +100,24 @@
|
|
|
101
100
|
element.removeEventListener(type, listener);
|
|
102
101
|
},
|
|
103
102
|
};
|
|
103
|
+
}
|
|
104
|
+
class TickDelayedEvent {
|
|
105
|
+
constructor() {
|
|
106
|
+
this._onFired = new Emitter();
|
|
107
|
+
this.onEvent = this._onFired.event;
|
|
108
|
+
}
|
|
109
|
+
fire() {
|
|
110
|
+
if (this.timer) {
|
|
111
|
+
clearTimeout(this.timer);
|
|
112
|
+
}
|
|
113
|
+
this.timer = setTimeout(() => {
|
|
114
|
+
this._onFired.fire();
|
|
115
|
+
clearTimeout(this.timer);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
dispose() {
|
|
119
|
+
this._onFired.dispose();
|
|
120
|
+
}
|
|
104
121
|
}
|
|
105
122
|
|
|
106
123
|
exports.Disposable = void 0;
|
|
@@ -119,7 +136,7 @@
|
|
|
119
136
|
return new CompositeDisposable(...args);
|
|
120
137
|
}
|
|
121
138
|
addDisposables(...args) {
|
|
122
|
-
args
|
|
139
|
+
args.forEach((arg) => this.disposables.push(arg));
|
|
123
140
|
}
|
|
124
141
|
dispose() {
|
|
125
142
|
this.disposables.forEach((arg) => arg.dispose());
|
|
@@ -138,20 +155,11 @@
|
|
|
138
155
|
dispose() {
|
|
139
156
|
if (this._disposable) {
|
|
140
157
|
this._disposable.dispose();
|
|
158
|
+
this._disposable = exports.Disposable.NONE;
|
|
141
159
|
}
|
|
142
160
|
}
|
|
143
161
|
}
|
|
144
162
|
|
|
145
|
-
function tryParseJSON(text, reviver) {
|
|
146
|
-
try {
|
|
147
|
-
return JSON.parse(text, reviver);
|
|
148
|
-
}
|
|
149
|
-
catch (err) {
|
|
150
|
-
console.warn('failed to parse JSON');
|
|
151
|
-
return undefined;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
163
|
class TransferObject {
|
|
156
164
|
constructor() {
|
|
157
165
|
//
|
|
@@ -172,45 +180,6 @@
|
|
|
172
180
|
this.paneId = paneId;
|
|
173
181
|
}
|
|
174
182
|
}
|
|
175
|
-
const DATA_KEY = 'splitview/transfer';
|
|
176
|
-
const isPanelTransferEvent = (event) => {
|
|
177
|
-
if (!event.dataTransfer) {
|
|
178
|
-
return false;
|
|
179
|
-
}
|
|
180
|
-
return event.dataTransfer.types.includes(DATA_KEY);
|
|
181
|
-
};
|
|
182
|
-
exports.DragType = void 0;
|
|
183
|
-
(function (DragType) {
|
|
184
|
-
DragType["DOCKVIEW_TAB"] = "dockview_tab";
|
|
185
|
-
DragType["EXTERNAL"] = "external_group_drag";
|
|
186
|
-
})(exports.DragType || (exports.DragType = {}));
|
|
187
|
-
/**
|
|
188
|
-
* Determine whether this data belong to that of an event that was started by
|
|
189
|
-
* dragging a tab component
|
|
190
|
-
*/
|
|
191
|
-
const isTabDragEvent = (data) => {
|
|
192
|
-
return data.type === exports.DragType.DOCKVIEW_TAB;
|
|
193
|
-
};
|
|
194
|
-
/**
|
|
195
|
-
* Determine whether this data belong to that of an event that was started by
|
|
196
|
-
* a custom drag-enable component
|
|
197
|
-
*/
|
|
198
|
-
const isCustomDragEvent = (data) => {
|
|
199
|
-
return data.type === exports.DragType.EXTERNAL;
|
|
200
|
-
};
|
|
201
|
-
const extractData = (event) => {
|
|
202
|
-
if (!event.dataTransfer) {
|
|
203
|
-
return null;
|
|
204
|
-
}
|
|
205
|
-
const data = tryParseJSON(event.dataTransfer.getData(DATA_KEY));
|
|
206
|
-
if (!data) {
|
|
207
|
-
console.warn(`[dragEvent] ${DATA_KEY} data is missing`);
|
|
208
|
-
}
|
|
209
|
-
if (typeof data.type !== 'string') {
|
|
210
|
-
console.warn(`[dragEvent] invalid type ${data.type}`);
|
|
211
|
-
}
|
|
212
|
-
return data;
|
|
213
|
-
};
|
|
214
183
|
/**
|
|
215
184
|
* A singleton to store transfer data during drag & drop operations that are only valid within the application.
|
|
216
185
|
*/
|
|
@@ -280,11 +249,17 @@
|
|
|
280
249
|
get length() {
|
|
281
250
|
return this.component.length;
|
|
282
251
|
}
|
|
252
|
+
get orientation() {
|
|
253
|
+
return this.component.orientation;
|
|
254
|
+
}
|
|
283
255
|
get onDidLayoutChange() {
|
|
284
256
|
return this.component.onDidLayoutChange;
|
|
285
257
|
}
|
|
286
|
-
get
|
|
287
|
-
return this.component.
|
|
258
|
+
get onDidAddView() {
|
|
259
|
+
return this.component.onDidAddView;
|
|
260
|
+
}
|
|
261
|
+
get onDidRemoveView() {
|
|
262
|
+
return this.component.onDidRemoveView;
|
|
288
263
|
}
|
|
289
264
|
updateOptions(options) {
|
|
290
265
|
this.component.updateOptions(options);
|
|
@@ -330,21 +305,38 @@
|
|
|
330
305
|
constructor(component) {
|
|
331
306
|
this.component = component;
|
|
332
307
|
}
|
|
333
|
-
get width() {
|
|
334
|
-
return this.component.width;
|
|
335
|
-
}
|
|
336
|
-
get height() {
|
|
337
|
-
return this.component.height;
|
|
338
|
-
}
|
|
339
308
|
get minimumSize() {
|
|
340
309
|
return this.component.minimumSize;
|
|
341
310
|
}
|
|
342
311
|
get maximumSize() {
|
|
343
312
|
return this.component.maximumSize;
|
|
344
313
|
}
|
|
314
|
+
get height() {
|
|
315
|
+
return this.component.height;
|
|
316
|
+
}
|
|
317
|
+
get width() {
|
|
318
|
+
return this.component.width;
|
|
319
|
+
}
|
|
345
320
|
get onDidLayoutChange() {
|
|
346
321
|
return this.component.onDidLayoutChange;
|
|
347
322
|
}
|
|
323
|
+
get onDidAddView() {
|
|
324
|
+
return this.component.onDidAddView;
|
|
325
|
+
}
|
|
326
|
+
get onDidRemoveView() {
|
|
327
|
+
return this.component.onDidRemoveView;
|
|
328
|
+
}
|
|
329
|
+
get onDidDrop() {
|
|
330
|
+
const emitter = new Emitter();
|
|
331
|
+
const disposable = this.component.onDidDrop((e) => {
|
|
332
|
+
emitter.fire(Object.assign(Object.assign({}, e), { api: this }));
|
|
333
|
+
});
|
|
334
|
+
emitter.dispose = () => {
|
|
335
|
+
disposable.dispose();
|
|
336
|
+
emitter.dispose();
|
|
337
|
+
};
|
|
338
|
+
return emitter.event;
|
|
339
|
+
}
|
|
348
340
|
getPanels() {
|
|
349
341
|
return this.component.getPanels();
|
|
350
342
|
}
|
|
@@ -380,12 +372,6 @@
|
|
|
380
372
|
constructor(component) {
|
|
381
373
|
this.component = component;
|
|
382
374
|
}
|
|
383
|
-
get width() {
|
|
384
|
-
return this.component.width;
|
|
385
|
-
}
|
|
386
|
-
get height() {
|
|
387
|
-
return this.component.height;
|
|
388
|
-
}
|
|
389
375
|
get minimumHeight() {
|
|
390
376
|
return this.component.minimumHeight;
|
|
391
377
|
}
|
|
@@ -398,12 +384,30 @@
|
|
|
398
384
|
get maximumWidth() {
|
|
399
385
|
return this.component.maximumWidth;
|
|
400
386
|
}
|
|
387
|
+
get width() {
|
|
388
|
+
return this.component.width;
|
|
389
|
+
}
|
|
390
|
+
get height() {
|
|
391
|
+
return this.component.height;
|
|
392
|
+
}
|
|
401
393
|
get onGridEvent() {
|
|
402
394
|
return this.component.onGridEvent;
|
|
403
395
|
}
|
|
404
396
|
get onDidLayoutChange() {
|
|
405
397
|
return this.component.onDidLayoutChange;
|
|
406
398
|
}
|
|
399
|
+
get onDidAddGroup() {
|
|
400
|
+
return this.component.onDidAddGroup;
|
|
401
|
+
}
|
|
402
|
+
get onDidRemoveGroup() {
|
|
403
|
+
return this.component.onDidRemoveGroup;
|
|
404
|
+
}
|
|
405
|
+
get onDidActiveGroupChange() {
|
|
406
|
+
return this.component.onDidActiveGroupChange;
|
|
407
|
+
}
|
|
408
|
+
get onDidLayoutFromJSON() {
|
|
409
|
+
return this.component.onDidLayoutFromJSON;
|
|
410
|
+
}
|
|
407
411
|
get panels() {
|
|
408
412
|
return this.component.groups;
|
|
409
413
|
}
|
|
@@ -481,6 +485,27 @@
|
|
|
481
485
|
get onGridEvent() {
|
|
482
486
|
return this.component.onGridEvent;
|
|
483
487
|
}
|
|
488
|
+
get onDidActiveGroupChange() {
|
|
489
|
+
return this.component.onDidActiveGroupChange;
|
|
490
|
+
}
|
|
491
|
+
get onDidAddGroup() {
|
|
492
|
+
return this.component.onDidAddGroup;
|
|
493
|
+
}
|
|
494
|
+
get onDidRemoveGroup() {
|
|
495
|
+
return this.component.onDidRemoveGroup;
|
|
496
|
+
}
|
|
497
|
+
get onDidActivePanelChange() {
|
|
498
|
+
return this.component.onDidActivePanelChange;
|
|
499
|
+
}
|
|
500
|
+
get onDidAddPanel() {
|
|
501
|
+
return this.component.onDidAddPanel;
|
|
502
|
+
}
|
|
503
|
+
get onDidRemovePanel() {
|
|
504
|
+
return this.component.onDidRemovePanel;
|
|
505
|
+
}
|
|
506
|
+
get onDidLayoutfromJSON() {
|
|
507
|
+
return this.component.onDidLayoutfromJSON;
|
|
508
|
+
}
|
|
484
509
|
get onDidLayoutChange() {
|
|
485
510
|
return this.component.onDidLayoutChange;
|
|
486
511
|
}
|
|
@@ -508,18 +533,12 @@
|
|
|
508
533
|
getPanel(id) {
|
|
509
534
|
return this.component.getGroupPanel(id);
|
|
510
535
|
}
|
|
511
|
-
setActivePanel(panel) {
|
|
512
|
-
this.component.setActivePanel(panel);
|
|
513
|
-
}
|
|
514
536
|
layout(width, height, force = false) {
|
|
515
537
|
this.component.layout(width, height, force);
|
|
516
538
|
}
|
|
517
539
|
addPanel(options) {
|
|
518
540
|
return this.component.addPanel(options);
|
|
519
541
|
}
|
|
520
|
-
removePanel(panel) {
|
|
521
|
-
this.component.removePanel(panel);
|
|
522
|
-
}
|
|
523
542
|
addEmptyGroup(options) {
|
|
524
543
|
this.component.addEmptyGroup(options);
|
|
525
544
|
}
|
|
@@ -867,7 +886,7 @@
|
|
|
867
886
|
this._onDidAddView = new Emitter();
|
|
868
887
|
this.onDidAddView = this._onDidAddView.event;
|
|
869
888
|
this._onDidRemoveView = new Emitter();
|
|
870
|
-
this.onDidRemoveView = this.
|
|
889
|
+
this.onDidRemoveView = this._onDidRemoveView.event;
|
|
871
890
|
this._startSnappingEnabled = true;
|
|
872
891
|
this._endSnappingEnabled = true;
|
|
873
892
|
this.resize = (index, delta, sizes = this.views.map((x) => x.size), lowPriorityIndexes, highPriorityIndexes, overloadMinDelta = Number.NEGATIVE_INFINITY, overloadMaxDelta = Number.POSITIVE_INFINITY, snapBefore, snapAfter) => {
|
|
@@ -1509,9 +1528,9 @@
|
|
|
1509
1528
|
var _a;
|
|
1510
1529
|
super();
|
|
1511
1530
|
this.paneItems = [];
|
|
1531
|
+
this.skipAnimation = false;
|
|
1512
1532
|
this._onDidChange = new Emitter();
|
|
1513
1533
|
this.onDidChange = this._onDidChange.event;
|
|
1514
|
-
this.skipAnimation = false;
|
|
1515
1534
|
this._orientation = (_a = options.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.VERTICAL;
|
|
1516
1535
|
this.element = document.createElement('div');
|
|
1517
1536
|
this.element.className = 'pane-container';
|
|
@@ -1539,7 +1558,7 @@
|
|
|
1539
1558
|
this.paneItems.push(paneItem);
|
|
1540
1559
|
pane.orthogonalSize = this.splitview.orthogonalSize;
|
|
1541
1560
|
});
|
|
1542
|
-
this.addDisposables(this.splitview.onDidSashEnd(() => {
|
|
1561
|
+
this.addDisposables(this._onDidChange, this.splitview.onDidSashEnd(() => {
|
|
1543
1562
|
this._onDidChange.fire(undefined);
|
|
1544
1563
|
}), this.splitview.onDidAddView(() => {
|
|
1545
1564
|
this._onDidChange.fire();
|
|
@@ -1611,9 +1630,6 @@
|
|
|
1611
1630
|
}
|
|
1612
1631
|
}
|
|
1613
1632
|
layout(size, orthogonalSize) {
|
|
1614
|
-
// for (const paneItem of this.paneItems) {
|
|
1615
|
-
// paneItem.pane.orthogonalSize = orthogonalSize;
|
|
1616
|
-
// }
|
|
1617
1633
|
this.splitview.layout(size, orthogonalSize);
|
|
1618
1634
|
}
|
|
1619
1635
|
setupAnimation() {
|
|
@@ -1703,7 +1719,7 @@
|
|
|
1703
1719
|
this.options = options;
|
|
1704
1720
|
this._onDrop = new Emitter();
|
|
1705
1721
|
this.onDrop = this._onDrop.event;
|
|
1706
|
-
this.addDisposables(new DragAndDropObserver(this.element, {
|
|
1722
|
+
this.addDisposables(this._onDrop, new DragAndDropObserver(this.element, {
|
|
1707
1723
|
onDragEnter: (e) => undefined,
|
|
1708
1724
|
onDragOver: (e) => {
|
|
1709
1725
|
if (isBooleanValue(this.options.canDisplayOverlay)) {
|
|
@@ -1739,51 +1755,11 @@
|
|
|
1739
1755
|
const y = e.offsetY;
|
|
1740
1756
|
const xp = (100 * x) / width;
|
|
1741
1757
|
const yp = (100 * y) / height;
|
|
1742
|
-
|
|
1743
|
-
let isLeft = false;
|
|
1744
|
-
let isTop = false;
|
|
1745
|
-
let isBottom = false;
|
|
1746
|
-
switch (this.options.validOverlays) {
|
|
1747
|
-
case 'all':
|
|
1748
|
-
isRight = xp > 80;
|
|
1749
|
-
isLeft = xp < 20;
|
|
1750
|
-
isTop = !isRight && !isLeft && yp < 20;
|
|
1751
|
-
isBottom = !isRight && !isLeft && yp > 80;
|
|
1752
|
-
break;
|
|
1753
|
-
case 'vertical':
|
|
1754
|
-
isTop = yp < 50;
|
|
1755
|
-
isBottom = yp >= 50;
|
|
1756
|
-
break;
|
|
1757
|
-
case 'horizontal':
|
|
1758
|
-
isLeft = xp < 50;
|
|
1759
|
-
isRight = xp >= 50;
|
|
1760
|
-
break;
|
|
1761
|
-
}
|
|
1758
|
+
const quadrant = this.calculateQuadrant(this.options.validOverlays, xp, yp);
|
|
1762
1759
|
const isSmallX = width < 100;
|
|
1763
1760
|
const isSmallY = height < 100;
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
toggleClass(this.overlay, 'top', !isSmallY && isTop);
|
|
1767
|
-
toggleClass(this.overlay, 'bottom', !isSmallY && isBottom);
|
|
1768
|
-
toggleClass(this.overlay, 'small-right', isSmallX && isRight);
|
|
1769
|
-
toggleClass(this.overlay, 'small-left', isSmallX && isLeft);
|
|
1770
|
-
toggleClass(this.overlay, 'small-top', isSmallY && isTop);
|
|
1771
|
-
toggleClass(this.overlay, 'small-bottom', isSmallY && isBottom);
|
|
1772
|
-
if (isRight) {
|
|
1773
|
-
this._state = exports.Position.Right;
|
|
1774
|
-
}
|
|
1775
|
-
else if (isLeft) {
|
|
1776
|
-
this._state = exports.Position.Left;
|
|
1777
|
-
}
|
|
1778
|
-
else if (isTop) {
|
|
1779
|
-
this._state = exports.Position.Top;
|
|
1780
|
-
}
|
|
1781
|
-
else if (isBottom) {
|
|
1782
|
-
this._state = exports.Position.Bottom;
|
|
1783
|
-
}
|
|
1784
|
-
else {
|
|
1785
|
-
this._state = exports.Position.Center;
|
|
1786
|
-
}
|
|
1761
|
+
this.toggleClasses(quadrant, isSmallX, isSmallY);
|
|
1762
|
+
this.setState(quadrant);
|
|
1787
1763
|
},
|
|
1788
1764
|
onDragLeave: (e) => {
|
|
1789
1765
|
this.removeDropTarget();
|
|
@@ -1797,7 +1773,7 @@
|
|
|
1797
1773
|
const state = this._state;
|
|
1798
1774
|
this.removeDropTarget();
|
|
1799
1775
|
if (state) {
|
|
1800
|
-
this._onDrop.fire({ position: state,
|
|
1776
|
+
this._onDrop.fire({ position: state, nativeEvent: e });
|
|
1801
1777
|
}
|
|
1802
1778
|
},
|
|
1803
1779
|
}));
|
|
@@ -1812,9 +1788,73 @@
|
|
|
1812
1788
|
this.options.canDisplayOverlay = value;
|
|
1813
1789
|
}
|
|
1814
1790
|
dispose() {
|
|
1815
|
-
this._onDrop.dispose();
|
|
1816
1791
|
this.removeDropTarget();
|
|
1817
1792
|
}
|
|
1793
|
+
toggleClasses(quadrant, isSmallX, isSmallY) {
|
|
1794
|
+
if (!this.overlay) {
|
|
1795
|
+
return;
|
|
1796
|
+
}
|
|
1797
|
+
const isLeft = quadrant === 'left';
|
|
1798
|
+
const isRight = quadrant === 'right';
|
|
1799
|
+
const isTop = quadrant === 'top';
|
|
1800
|
+
const isBottom = quadrant === 'bottom';
|
|
1801
|
+
toggleClass(this.overlay, 'right', !isSmallX && isRight);
|
|
1802
|
+
toggleClass(this.overlay, 'left', !isSmallX && isLeft);
|
|
1803
|
+
toggleClass(this.overlay, 'top', !isSmallY && isTop);
|
|
1804
|
+
toggleClass(this.overlay, 'bottom', !isSmallY && isBottom);
|
|
1805
|
+
toggleClass(this.overlay, 'small-right', isSmallX && isRight);
|
|
1806
|
+
toggleClass(this.overlay, 'small-left', isSmallX && isLeft);
|
|
1807
|
+
toggleClass(this.overlay, 'small-top', isSmallY && isTop);
|
|
1808
|
+
toggleClass(this.overlay, 'small-bottom', isSmallY && isBottom);
|
|
1809
|
+
}
|
|
1810
|
+
setState(quadrant) {
|
|
1811
|
+
switch (quadrant) {
|
|
1812
|
+
case 'top':
|
|
1813
|
+
this._state = exports.Position.Top;
|
|
1814
|
+
break;
|
|
1815
|
+
case 'left':
|
|
1816
|
+
this._state = exports.Position.Left;
|
|
1817
|
+
break;
|
|
1818
|
+
case 'bottom':
|
|
1819
|
+
this._state = exports.Position.Bottom;
|
|
1820
|
+
break;
|
|
1821
|
+
case 'right':
|
|
1822
|
+
this._state = exports.Position.Right;
|
|
1823
|
+
break;
|
|
1824
|
+
default:
|
|
1825
|
+
this._state = exports.Position.Center;
|
|
1826
|
+
break;
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
calculateQuadrant(overlayType, xp, yp) {
|
|
1830
|
+
switch (overlayType) {
|
|
1831
|
+
case 'all':
|
|
1832
|
+
if (xp < 20) {
|
|
1833
|
+
return 'left';
|
|
1834
|
+
}
|
|
1835
|
+
if (xp > 80) {
|
|
1836
|
+
return 'right';
|
|
1837
|
+
}
|
|
1838
|
+
if (yp < 20) {
|
|
1839
|
+
return 'top';
|
|
1840
|
+
}
|
|
1841
|
+
if (yp > 80) {
|
|
1842
|
+
return 'bottom';
|
|
1843
|
+
}
|
|
1844
|
+
break;
|
|
1845
|
+
case 'vertical':
|
|
1846
|
+
if (yp < 50) {
|
|
1847
|
+
return 'top';
|
|
1848
|
+
}
|
|
1849
|
+
return 'bottom';
|
|
1850
|
+
case 'horizontal':
|
|
1851
|
+
if (xp < 50) {
|
|
1852
|
+
return 'left';
|
|
1853
|
+
}
|
|
1854
|
+
return 'right';
|
|
1855
|
+
}
|
|
1856
|
+
return null;
|
|
1857
|
+
}
|
|
1818
1858
|
removeDropTarget() {
|
|
1819
1859
|
if (this.target) {
|
|
1820
1860
|
this._state = undefined;
|
|
@@ -1917,6 +1957,7 @@
|
|
|
1917
1957
|
this.view.layout(this.width, this.height);
|
|
1918
1958
|
}
|
|
1919
1959
|
dispose() {
|
|
1960
|
+
this._onDidChange.dispose();
|
|
1920
1961
|
this._disposable.dispose();
|
|
1921
1962
|
}
|
|
1922
1963
|
}
|
|
@@ -1968,7 +2009,7 @@
|
|
|
1968
2009
|
proportionalLayout,
|
|
1969
2010
|
});
|
|
1970
2011
|
}
|
|
1971
|
-
this.addDisposables(this.splitview.onDidSashEnd(() => {
|
|
2012
|
+
this.addDisposables(this._onDidChange, this.splitview.onDidSashEnd(() => {
|
|
1972
2013
|
this._onDidChange.fire(undefined);
|
|
1973
2014
|
}));
|
|
1974
2015
|
this.setupChildrenEvents();
|
|
@@ -2140,6 +2181,15 @@
|
|
|
2140
2181
|
* Accreditation: This file is largly based upon the MIT licenced VSCode sourcecode found at:
|
|
2141
2182
|
* https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid
|
|
2142
2183
|
*--------------------------------------------------------------------------------------------*/
|
|
2184
|
+
function findLeaf(candiateNode, last) {
|
|
2185
|
+
if (candiateNode instanceof LeafNode) {
|
|
2186
|
+
return candiateNode;
|
|
2187
|
+
}
|
|
2188
|
+
if (candiateNode instanceof BranchNode) {
|
|
2189
|
+
return findLeaf(candiateNode.children[last ? candiateNode.children.length - 1 : 0], last);
|
|
2190
|
+
}
|
|
2191
|
+
throw new Error('invalid node');
|
|
2192
|
+
}
|
|
2143
2193
|
function flipNode(node, size, orthogonalSize) {
|
|
2144
2194
|
if (node instanceof BranchNode) {
|
|
2145
2195
|
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize);
|
|
@@ -2278,13 +2328,13 @@
|
|
|
2278
2328
|
}
|
|
2279
2329
|
deserialize(json, deserializer) {
|
|
2280
2330
|
const orientation = json.orientation;
|
|
2281
|
-
const height = json.height;
|
|
2331
|
+
const height = orientation === exports.Orientation.VERTICAL ? json.height : json.width;
|
|
2282
2332
|
this._deserialize(json.root, orientation, deserializer, height);
|
|
2283
2333
|
}
|
|
2284
2334
|
_deserialize(root, orientation, deserializer, orthogonalSize) {
|
|
2285
|
-
this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize);
|
|
2335
|
+
this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize, true);
|
|
2286
2336
|
}
|
|
2287
|
-
_deserializeNode(node, orientation, deserializer, orthogonalSize) {
|
|
2337
|
+
_deserializeNode(node, orientation, deserializer, orthogonalSize, isRoot = false) {
|
|
2288
2338
|
let result;
|
|
2289
2339
|
if (node.type === 'branch') {
|
|
2290
2340
|
const serializedChildren = node.data;
|
|
@@ -2294,7 +2344,9 @@
|
|
|
2294
2344
|
visible: serializedChild.visible,
|
|
2295
2345
|
};
|
|
2296
2346
|
});
|
|
2297
|
-
|
|
2347
|
+
// HORIZONTAL => height=orthogonalsize width=size
|
|
2348
|
+
// VERTICAL => height=size width=orthogonalsize
|
|
2349
|
+
result = new BranchNode(orientation, this.proportionalLayout, this.styles, isRoot ? orthogonalSize : node.size, isRoot ? node.size : orthogonalSize, children);
|
|
2298
2350
|
}
|
|
2299
2351
|
else {
|
|
2300
2352
|
result = new LeafNode(deserializer.fromJSON(node), orientation, orthogonalSize, node.size);
|
|
@@ -2355,15 +2407,6 @@
|
|
|
2355
2407
|
if (!(node instanceof LeafNode)) {
|
|
2356
2408
|
throw new Error('invalid location');
|
|
2357
2409
|
}
|
|
2358
|
-
const findLeaf = (candiateNode, last) => {
|
|
2359
|
-
if (candiateNode instanceof LeafNode) {
|
|
2360
|
-
return candiateNode;
|
|
2361
|
-
}
|
|
2362
|
-
if (candiateNode instanceof BranchNode) {
|
|
2363
|
-
return findLeaf(candiateNode.children[last ? candiateNode.children.length - 1 : 0], last);
|
|
2364
|
-
}
|
|
2365
|
-
throw new Error('invalid node');
|
|
2366
|
-
};
|
|
2367
2410
|
for (let i = path.length - 1; i > -1; i--) {
|
|
2368
2411
|
const n = path[i];
|
|
2369
2412
|
const l = location[i] || 0;
|
|
@@ -2460,15 +2503,14 @@
|
|
|
2460
2503
|
}
|
|
2461
2504
|
parent.removeChild(index, sizing);
|
|
2462
2505
|
if (parent.children.length === 0) {
|
|
2463
|
-
// throw new Error('Invalid grid state');
|
|
2464
2506
|
return node.view;
|
|
2465
2507
|
}
|
|
2466
2508
|
if (parent.children.length > 1) {
|
|
2467
2509
|
return node.view;
|
|
2468
2510
|
}
|
|
2511
|
+
const sibling = parent.children[0];
|
|
2469
2512
|
if (pathToParent.length === 0) {
|
|
2470
2513
|
// parent is root
|
|
2471
|
-
const sibling = parent.children[0];
|
|
2472
2514
|
if (sibling instanceof LeafNode) {
|
|
2473
2515
|
return node.view;
|
|
2474
2516
|
}
|
|
@@ -2479,7 +2521,6 @@
|
|
|
2479
2521
|
}
|
|
2480
2522
|
const [grandParent, ..._] = [...pathToParent].reverse();
|
|
2481
2523
|
const [parentIndex, ...__] = [...rest].reverse();
|
|
2482
|
-
const sibling = parent.children[0];
|
|
2483
2524
|
const isSiblingVisible = parent.isChildVisible(0);
|
|
2484
2525
|
parent.removeChild(0, sizing);
|
|
2485
2526
|
const sizes = grandParent.children.map((size, i) => grandParent.getChildSize(i));
|
|
@@ -2526,31 +2567,6 @@
|
|
|
2526
2567
|
}
|
|
2527
2568
|
}
|
|
2528
2569
|
|
|
2529
|
-
/*! *****************************************************************************
|
|
2530
|
-
Copyright (c) Microsoft Corporation.
|
|
2531
|
-
|
|
2532
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
2533
|
-
purpose with or without fee is hereby granted.
|
|
2534
|
-
|
|
2535
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2536
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2537
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2538
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2539
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2540
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2541
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
2542
|
-
***************************************************************************** */
|
|
2543
|
-
|
|
2544
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
2545
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2546
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2547
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2548
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2549
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2550
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2551
|
-
});
|
|
2552
|
-
}
|
|
2553
|
-
|
|
2554
2570
|
class ContentContainer extends CompositeDisposable {
|
|
2555
2571
|
constructor() {
|
|
2556
2572
|
super();
|
|
@@ -2562,6 +2578,7 @@
|
|
|
2562
2578
|
this._element = document.createElement('div');
|
|
2563
2579
|
this._element.className = 'content-container';
|
|
2564
2580
|
this._element.tabIndex = -1;
|
|
2581
|
+
this.addDisposables(this._onDidFocus, this._onDidBlur);
|
|
2565
2582
|
// for hosted containers
|
|
2566
2583
|
// 1) register a drop target on the host
|
|
2567
2584
|
// 2) register window dragStart events to disable pointer events
|
|
@@ -2628,6 +2645,41 @@
|
|
|
2628
2645
|
DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
|
|
2629
2646
|
})(DockviewDropTargets || (DockviewDropTargets = {}));
|
|
2630
2647
|
|
|
2648
|
+
class DragHandler extends CompositeDisposable {
|
|
2649
|
+
constructor(el) {
|
|
2650
|
+
super();
|
|
2651
|
+
this.el = el;
|
|
2652
|
+
this.disposable = new MutableDisposable();
|
|
2653
|
+
this._onDragStart = new Emitter();
|
|
2654
|
+
this.onDragStart = this._onDragStart.event;
|
|
2655
|
+
this.iframes = [];
|
|
2656
|
+
this.configure();
|
|
2657
|
+
}
|
|
2658
|
+
configure() {
|
|
2659
|
+
this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
|
|
2660
|
+
this.iframes = [
|
|
2661
|
+
...getElementsByTagName('iframe'),
|
|
2662
|
+
...getElementsByTagName('webview'),
|
|
2663
|
+
];
|
|
2664
|
+
for (const iframe of this.iframes) {
|
|
2665
|
+
iframe.style.pointerEvents = 'none';
|
|
2666
|
+
}
|
|
2667
|
+
this.el.classList.add('dragged');
|
|
2668
|
+
setTimeout(() => this.el.classList.remove('dragged'), 0);
|
|
2669
|
+
this.disposable.value = this.getData();
|
|
2670
|
+
if (event.dataTransfer) {
|
|
2671
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
2672
|
+
}
|
|
2673
|
+
}), addDisposableListener(this.el, 'dragend', (ev) => {
|
|
2674
|
+
for (const iframe of this.iframes) {
|
|
2675
|
+
iframe.style.pointerEvents = 'auto';
|
|
2676
|
+
}
|
|
2677
|
+
this.iframes = [];
|
|
2678
|
+
this.disposable.dispose();
|
|
2679
|
+
}));
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2631
2683
|
exports.MouseEventKind = void 0;
|
|
2632
2684
|
(function (MouseEventKind) {
|
|
2633
2685
|
MouseEventKind["CLICK"] = "CLICK";
|
|
@@ -2637,42 +2689,34 @@
|
|
|
2637
2689
|
constructor(panelId, accessor, group) {
|
|
2638
2690
|
super();
|
|
2639
2691
|
this.panelId = panelId;
|
|
2640
|
-
this.accessor = accessor;
|
|
2641
2692
|
this.group = group;
|
|
2642
2693
|
this._onChanged = new Emitter();
|
|
2643
2694
|
this.onChanged = this._onChanged.event;
|
|
2644
2695
|
this._onDropped = new Emitter();
|
|
2645
2696
|
this.onDrop = this._onDropped.event;
|
|
2646
|
-
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
2647
|
-
this.iframes = [];
|
|
2648
2697
|
this.addDisposables(this._onChanged, this._onDropped);
|
|
2649
2698
|
this._element = document.createElement('div');
|
|
2650
2699
|
this._element.className = 'tab';
|
|
2651
2700
|
this._element.tabIndex = 0;
|
|
2652
2701
|
this._element.draggable = true;
|
|
2653
|
-
this.addDisposables(
|
|
2654
|
-
|
|
2655
|
-
...
|
|
2656
|
-
|
|
2657
|
-
];
|
|
2658
|
-
for (const iframe of this.iframes) {
|
|
2659
|
-
iframe.style.pointerEvents = 'none';
|
|
2702
|
+
this.addDisposables(new (class Handler extends DragHandler {
|
|
2703
|
+
constructor() {
|
|
2704
|
+
super(...arguments);
|
|
2705
|
+
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
2660
2706
|
}
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2707
|
+
getData() {
|
|
2708
|
+
this.panelTransfer.setData([new PanelTransfer(accessor.id, group.id, panelId)], PanelTransfer.prototype);
|
|
2709
|
+
return {
|
|
2710
|
+
dispose: () => {
|
|
2711
|
+
this.panelTransfer.clearData(PanelTransfer.prototype);
|
|
2712
|
+
},
|
|
2713
|
+
};
|
|
2668
2714
|
}
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
iframe.style.pointerEvents = 'auto';
|
|
2715
|
+
dispose() {
|
|
2716
|
+
//
|
|
2672
2717
|
}
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
}), addDisposableListener(this._element, 'mousedown', (event) => {
|
|
2718
|
+
})(this._element));
|
|
2719
|
+
this.addDisposables(addDisposableListener(this._element, 'mousedown', (event) => {
|
|
2676
2720
|
if (event.defaultPrevented) {
|
|
2677
2721
|
return;
|
|
2678
2722
|
}
|
|
@@ -2761,7 +2805,7 @@
|
|
|
2761
2805
|
});
|
|
2762
2806
|
this.addDisposables(this.voidDropTarget.onDrop((event) => {
|
|
2763
2807
|
this._onDrop.fire({
|
|
2764
|
-
event: event.
|
|
2808
|
+
event: event.nativeEvent,
|
|
2765
2809
|
index: this.tabs.length,
|
|
2766
2810
|
});
|
|
2767
2811
|
}), this.voidDropTarget, addDisposableListener(this.tabContainer, 'mousedown', (event) => {
|
|
@@ -2874,16 +2918,14 @@
|
|
|
2874
2918
|
if (!isLeftClick || event.event.defaultPrevented) {
|
|
2875
2919
|
return;
|
|
2876
2920
|
}
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
});
|
|
2882
|
-
break;
|
|
2921
|
+
if (event.kind === exports.MouseEventKind.CLICK) {
|
|
2922
|
+
this.group.model.openPanel(panel, {
|
|
2923
|
+
skipFocus: alreadyFocused,
|
|
2924
|
+
});
|
|
2883
2925
|
}
|
|
2884
2926
|
}), tabToAdd.onDrop((event) => {
|
|
2885
2927
|
this._onDrop.fire({
|
|
2886
|
-
event: event.
|
|
2928
|
+
event: event.nativeEvent,
|
|
2887
2929
|
index: this.tabs.findIndex((x) => x.value === tabToAdd),
|
|
2888
2930
|
});
|
|
2889
2931
|
}));
|
|
@@ -2908,7 +2950,6 @@
|
|
|
2908
2950
|
GroupChangeKind2["ADD_PANEL"] = "ADD_PANEL";
|
|
2909
2951
|
GroupChangeKind2["REMOVE_PANEL"] = "REMOVE_PANEL";
|
|
2910
2952
|
GroupChangeKind2["PANEL_ACTIVE"] = "PANEL_ACTIVE";
|
|
2911
|
-
GroupChangeKind2["GROUP_ACTIVE"] = "GROUP_ACTIVE";
|
|
2912
2953
|
})(exports.GroupChangeKind2 || (exports.GroupChangeKind2 = {}));
|
|
2913
2954
|
class Groupview extends CompositeDisposable {
|
|
2914
2955
|
constructor(container, accessor, id, options, parent) {
|
|
@@ -2929,15 +2970,10 @@
|
|
|
2929
2970
|
this.onMove = this._onMove.event;
|
|
2930
2971
|
this._onDidGroupChange = new Emitter();
|
|
2931
2972
|
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
2932
|
-
this.
|
|
2933
|
-
|
|
2934
|
-
return false;
|
|
2935
|
-
}
|
|
2936
|
-
this.doClose(panel);
|
|
2937
|
-
return true;
|
|
2938
|
-
});
|
|
2973
|
+
this._onDidDrop = new Emitter();
|
|
2974
|
+
this.onDidDrop = this._onDidDrop.event;
|
|
2939
2975
|
this.container.classList.add('groupview');
|
|
2940
|
-
this.addDisposables(this._onMove, this._onDidGroupChange);
|
|
2976
|
+
this.addDisposables(this._onMove, this._onDidGroupChange, this._onDidChange, this._onDidDrop);
|
|
2941
2977
|
this.tabsContainer = new TabsContainer(this.accessor, this.parent, {
|
|
2942
2978
|
tabHeight: options.tabHeight,
|
|
2943
2979
|
});
|
|
@@ -2959,9 +2995,9 @@
|
|
|
2959
2995
|
}), this.contentContainer.onDidFocus(() => {
|
|
2960
2996
|
this.accessor.doSetGroupActive(this.parent, true);
|
|
2961
2997
|
}), this.contentContainer.onDidBlur(() => {
|
|
2962
|
-
//
|
|
2998
|
+
// noop
|
|
2963
2999
|
}), this.dropTarget.onDrop((event) => {
|
|
2964
|
-
this.handleDropEvent(event.
|
|
3000
|
+
this.handleDropEvent(event.nativeEvent, event.position);
|
|
2965
3001
|
}));
|
|
2966
3002
|
}
|
|
2967
3003
|
get element() {
|
|
@@ -3094,6 +3130,8 @@
|
|
|
3094
3130
|
options.index > this.panels.length) {
|
|
3095
3131
|
options.index = this.panels.length;
|
|
3096
3132
|
}
|
|
3133
|
+
// ensure the group is updated before we fire any events
|
|
3134
|
+
panel.updateParentGroup(this.parent, true);
|
|
3097
3135
|
if (this._activePanel === panel) {
|
|
3098
3136
|
this.accessor.doSetGroupActive(this.parent);
|
|
3099
3137
|
return;
|
|
@@ -3114,43 +3152,19 @@
|
|
|
3114
3152
|
return this._removePanel(panelToRemove);
|
|
3115
3153
|
}
|
|
3116
3154
|
closeAllPanels() {
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
const
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
if (this._activePanel && index > -1) {
|
|
3123
|
-
if (this.panels.indexOf(this._activePanel) < 0) {
|
|
3124
|
-
console.warn('active panel not tracked');
|
|
3125
|
-
}
|
|
3126
|
-
const canClose = !((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.close) || (yield this._activePanel.close());
|
|
3127
|
-
if (!canClose) {
|
|
3128
|
-
return false;
|
|
3129
|
-
}
|
|
3130
|
-
}
|
|
3131
|
-
for (let i = 0; i < this.panels.length; i++) {
|
|
3132
|
-
if (i === index) {
|
|
3133
|
-
continue;
|
|
3134
|
-
}
|
|
3135
|
-
const panel = this.panels[i];
|
|
3136
|
-
this.openPanel(panel);
|
|
3137
|
-
if (panel.close) {
|
|
3138
|
-
const canClose = yield panel.close();
|
|
3139
|
-
if (!canClose) {
|
|
3140
|
-
return false;
|
|
3141
|
-
}
|
|
3142
|
-
}
|
|
3143
|
-
}
|
|
3144
|
-
if (this.panels.length > 0) {
|
|
3145
|
-
// take a copy since we will be edting the array as we iterate through
|
|
3146
|
-
const arrPanelCpy = [...this.panels];
|
|
3147
|
-
yield Promise.all(arrPanelCpy.map((p) => this.doClose(p)));
|
|
3155
|
+
if (this.panels.length > 0) {
|
|
3156
|
+
// take a copy since we will be edting the array as we iterate through
|
|
3157
|
+
const arrPanelCpy = [...this.panels];
|
|
3158
|
+
for (const panel of arrPanelCpy) {
|
|
3159
|
+
this.doClose(panel);
|
|
3148
3160
|
}
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3161
|
+
}
|
|
3162
|
+
else {
|
|
3163
|
+
this.accessor.removeGroup(this.parent);
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
closePanel(panel) {
|
|
3167
|
+
this.doClose(panel);
|
|
3154
3168
|
}
|
|
3155
3169
|
doClose(panel) {
|
|
3156
3170
|
this.accessor.removePanel(panel);
|
|
@@ -3293,8 +3307,11 @@
|
|
|
3293
3307
|
this.tabsContainer.show();
|
|
3294
3308
|
}
|
|
3295
3309
|
}
|
|
3296
|
-
canDisplayOverlay(
|
|
3310
|
+
canDisplayOverlay(event, target) {
|
|
3297
3311
|
// custom overlay handler
|
|
3312
|
+
if (this.accessor.options.showDndOverlay) {
|
|
3313
|
+
return this.accessor.options.showDndOverlay(event, target);
|
|
3314
|
+
}
|
|
3298
3315
|
return false;
|
|
3299
3316
|
}
|
|
3300
3317
|
handleDropEvent(event, position, index) {
|
|
@@ -3319,6 +3336,9 @@
|
|
|
3319
3336
|
index,
|
|
3320
3337
|
});
|
|
3321
3338
|
}
|
|
3339
|
+
else {
|
|
3340
|
+
this._onDidDrop.fire({ nativeEvent: event, position, index });
|
|
3341
|
+
}
|
|
3322
3342
|
}
|
|
3323
3343
|
dispose() {
|
|
3324
3344
|
for (const panel of this.panels) {
|
|
@@ -3371,19 +3391,21 @@
|
|
|
3371
3391
|
this.onGridEvent = this._onGridEvent.event;
|
|
3372
3392
|
this._onDidLayoutChange = new Emitter();
|
|
3373
3393
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
3394
|
+
this._onDidRemoveGroup = new Emitter();
|
|
3395
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
3396
|
+
this._onDidAddGroup = new Emitter();
|
|
3397
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
3398
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
3399
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
3374
3400
|
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
3375
3401
|
this.element.appendChild(this.gridview.element);
|
|
3376
|
-
|
|
3377
|
-
this.layout(0, 0, true);
|
|
3402
|
+
this.layout(0, 0, true); // set some elements height/widths
|
|
3378
3403
|
this.addDisposables(this.gridview.onDidChange(() => {
|
|
3379
3404
|
this._onGridEvent.fire({ kind: exports.GroupChangeKind.LAYOUT });
|
|
3380
3405
|
}));
|
|
3381
3406
|
this.addDisposables((() => {
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
*/
|
|
3385
|
-
let timer;
|
|
3386
|
-
return this.onGridEvent((event) => {
|
|
3407
|
+
const tickDelayedEvent = new TickDelayedEvent();
|
|
3408
|
+
return new CompositeDisposable(this.onGridEvent((event) => {
|
|
3387
3409
|
if ([
|
|
3388
3410
|
exports.GroupChangeKind.ADD_GROUP,
|
|
3389
3411
|
exports.GroupChangeKind.REMOVE_GROUP,
|
|
@@ -3393,15 +3415,11 @@
|
|
|
3393
3415
|
exports.GroupChangeKind.PANEL_ACTIVE,
|
|
3394
3416
|
exports.GroupChangeKind.LAYOUT,
|
|
3395
3417
|
].includes(event.kind)) {
|
|
3396
|
-
|
|
3397
|
-
clearTimeout(timer);
|
|
3398
|
-
}
|
|
3399
|
-
timer = setTimeout(() => {
|
|
3400
|
-
this._onDidLayoutChange.fire();
|
|
3401
|
-
clearTimeout(timer);
|
|
3402
|
-
});
|
|
3418
|
+
tickDelayedEvent.fire();
|
|
3403
3419
|
}
|
|
3404
|
-
})
|
|
3420
|
+
}), tickDelayedEvent.onEvent(() => {
|
|
3421
|
+
this._onDidLayoutChange.fire();
|
|
3422
|
+
}), tickDelayedEvent);
|
|
3405
3423
|
})());
|
|
3406
3424
|
}
|
|
3407
3425
|
get id() {
|
|
@@ -3447,6 +3465,7 @@
|
|
|
3447
3465
|
doAddGroup(group, location = [0], size) {
|
|
3448
3466
|
this.gridview.addView(group, size !== null && size !== void 0 ? size : exports.Sizing.Distribute, location);
|
|
3449
3467
|
this._onGridEvent.fire({ kind: exports.GroupChangeKind.ADD_GROUP });
|
|
3468
|
+
this._onDidAddGroup.fire(group);
|
|
3450
3469
|
this.doSetGroupActive(group);
|
|
3451
3470
|
}
|
|
3452
3471
|
doRemoveGroup(group, options) {
|
|
@@ -3460,6 +3479,7 @@
|
|
|
3460
3479
|
this._groups.delete(group.id);
|
|
3461
3480
|
}
|
|
3462
3481
|
this._onGridEvent.fire({ kind: exports.GroupChangeKind.REMOVE_GROUP });
|
|
3482
|
+
this._onDidRemoveGroup.fire(group);
|
|
3463
3483
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
3464
3484
|
const groups = Array.from(this._groups.values());
|
|
3465
3485
|
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
@@ -3490,6 +3510,7 @@
|
|
|
3490
3510
|
this._onGridEvent.fire({
|
|
3491
3511
|
kind: exports.GroupChangeKind.GROUP_ACTIVE,
|
|
3492
3512
|
});
|
|
3513
|
+
this._onDidActiveGroupChange.fire(group);
|
|
3493
3514
|
}
|
|
3494
3515
|
removeGroup(group) {
|
|
3495
3516
|
this.doRemoveGroup(group);
|
|
@@ -3546,6 +3567,10 @@
|
|
|
3546
3567
|
dispose() {
|
|
3547
3568
|
super.dispose();
|
|
3548
3569
|
this._onGridEvent.dispose();
|
|
3570
|
+
this._onDidActiveGroupChange.dispose();
|
|
3571
|
+
this._onDidAddGroup.dispose();
|
|
3572
|
+
this._onDidRemoveGroup.dispose();
|
|
3573
|
+
this._onDidLayoutChange.dispose();
|
|
3549
3574
|
this.gridview.dispose();
|
|
3550
3575
|
}
|
|
3551
3576
|
}
|
|
@@ -3557,15 +3582,11 @@
|
|
|
3557
3582
|
constructor(id) {
|
|
3558
3583
|
super();
|
|
3559
3584
|
this.id = id;
|
|
3560
|
-
this._state = {};
|
|
3561
3585
|
this._isFocused = false;
|
|
3562
3586
|
this._isActive = false;
|
|
3563
3587
|
this._isVisible = true;
|
|
3564
3588
|
this._width = 0;
|
|
3565
3589
|
this._height = 0;
|
|
3566
|
-
this._onDidStateChange = new Emitter();
|
|
3567
|
-
this.onDidStateChange = this._onDidStateChange.event;
|
|
3568
|
-
//
|
|
3569
3590
|
this._onDidPanelDimensionChange = new Emitter({
|
|
3570
3591
|
replay: true,
|
|
3571
3592
|
});
|
|
@@ -3594,7 +3615,7 @@
|
|
|
3594
3615
|
//
|
|
3595
3616
|
this._onActiveChange = new Emitter();
|
|
3596
3617
|
this.onActiveChange = this._onActiveChange.event;
|
|
3597
|
-
this.addDisposables(this.
|
|
3618
|
+
this.addDisposables(this._onDidPanelDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onFocusEvent, this._onActiveChange, this._onVisibilityChange, this.onDidFocusChange((event) => {
|
|
3598
3619
|
this._isFocused = event.isFocused;
|
|
3599
3620
|
}), this.onDidActiveChange((event) => {
|
|
3600
3621
|
this._isActive = event.isActive;
|
|
@@ -3627,21 +3648,6 @@
|
|
|
3627
3648
|
setActive() {
|
|
3628
3649
|
this._onActiveChange.fire();
|
|
3629
3650
|
}
|
|
3630
|
-
setState(key, value) {
|
|
3631
|
-
if (typeof key === 'object') {
|
|
3632
|
-
this._state = key;
|
|
3633
|
-
}
|
|
3634
|
-
else if (typeof value !== undefined) {
|
|
3635
|
-
this._state[key] = value;
|
|
3636
|
-
}
|
|
3637
|
-
this._onDidStateChange.fire(undefined);
|
|
3638
|
-
}
|
|
3639
|
-
getState() {
|
|
3640
|
-
return this._state;
|
|
3641
|
-
}
|
|
3642
|
-
getStateKey(key) {
|
|
3643
|
-
return this._state[key];
|
|
3644
|
-
}
|
|
3645
3651
|
dispose() {
|
|
3646
3652
|
super.dispose();
|
|
3647
3653
|
}
|
|
@@ -3661,6 +3667,7 @@
|
|
|
3661
3667
|
//
|
|
3662
3668
|
this._onDidSizeChange = new Emitter();
|
|
3663
3669
|
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
3670
|
+
this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
|
|
3664
3671
|
}
|
|
3665
3672
|
setConstraints(value) {
|
|
3666
3673
|
this._onDidConstraintsChangeInternal.fire(value);
|
|
@@ -3674,19 +3681,19 @@
|
|
|
3674
3681
|
constructor(panel, group) {
|
|
3675
3682
|
super(panel.id);
|
|
3676
3683
|
this.panel = panel;
|
|
3677
|
-
this._onDidDirtyChange = new Emitter();
|
|
3678
|
-
this.onDidDirtyChange = this._onDidDirtyChange.event;
|
|
3679
3684
|
this._onDidTitleChange = new Emitter();
|
|
3680
3685
|
this.onDidTitleChange = this._onDidTitleChange.event;
|
|
3681
3686
|
this._titleChanged = new Emitter();
|
|
3682
3687
|
this.titleChanged = this._titleChanged.event;
|
|
3683
3688
|
this._suppressClosableChanged = new Emitter();
|
|
3684
3689
|
this.suppressClosableChanged = this._suppressClosableChanged.event;
|
|
3685
|
-
this.
|
|
3686
|
-
this.
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
3691
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
3692
|
+
this._onDidGroupChange = new Emitter();
|
|
3693
|
+
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
3694
|
+
this.disposable = new MutableDisposable();
|
|
3695
|
+
this.group = group;
|
|
3696
|
+
this.addDisposables(this.disposable, this._onDidTitleChange, this._titleChanged, this._suppressClosableChanged, this._onDidGroupChange, this._onDidActiveGroupChange);
|
|
3690
3697
|
}
|
|
3691
3698
|
get title() {
|
|
3692
3699
|
return this.panel.title;
|
|
@@ -3699,7 +3706,17 @@
|
|
|
3699
3706
|
return !!((_a = this.group) === null || _a === void 0 ? void 0 : _a.isActive);
|
|
3700
3707
|
}
|
|
3701
3708
|
set group(value) {
|
|
3709
|
+
const isOldGroupActive = this.isGroupActive;
|
|
3702
3710
|
this._group = value;
|
|
3711
|
+
this._onDidGroupChange.fire();
|
|
3712
|
+
if (this._group) {
|
|
3713
|
+
this.disposable.value = this._group.api.onDidActiveChange(() => {
|
|
3714
|
+
this._onDidActiveGroupChange.fire();
|
|
3715
|
+
});
|
|
3716
|
+
if (this.isGroupActive !== isOldGroupActive) {
|
|
3717
|
+
this._onDidActiveGroupChange.fire();
|
|
3718
|
+
}
|
|
3719
|
+
}
|
|
3703
3720
|
}
|
|
3704
3721
|
get group() {
|
|
3705
3722
|
return this._group;
|
|
@@ -3713,16 +3730,10 @@
|
|
|
3713
3730
|
}
|
|
3714
3731
|
return this.group.model.closePanel(this.panel);
|
|
3715
3732
|
}
|
|
3716
|
-
interceptOnCloseAction(interceptor) {
|
|
3717
|
-
this._interceptor = interceptor;
|
|
3718
|
-
}
|
|
3719
|
-
dispose() {
|
|
3720
|
-
super.dispose();
|
|
3721
|
-
}
|
|
3722
3733
|
}
|
|
3723
3734
|
|
|
3724
3735
|
class DockviewGroupPanel extends CompositeDisposable {
|
|
3725
|
-
constructor(id, containerApi) {
|
|
3736
|
+
constructor(id, accessor, containerApi) {
|
|
3726
3737
|
super();
|
|
3727
3738
|
this.id = id;
|
|
3728
3739
|
this.containerApi = containerApi;
|
|
@@ -3730,9 +3741,8 @@
|
|
|
3730
3741
|
this._suppressClosable = false;
|
|
3731
3742
|
this._title = '';
|
|
3732
3743
|
this.api = new DockviewPanelApiImpl(this, this._group);
|
|
3733
|
-
this.onDidStateChange = this.api.onDidStateChange;
|
|
3734
3744
|
this.addDisposables(this.api.onActiveChange(() => {
|
|
3735
|
-
|
|
3745
|
+
accessor.setActivePanel(this);
|
|
3736
3746
|
}), this.api.onDidTitleChange((event) => {
|
|
3737
3747
|
const title = event.title;
|
|
3738
3748
|
this.update({ params: { title } });
|
|
@@ -3756,32 +3766,18 @@
|
|
|
3756
3766
|
this._view = params.view;
|
|
3757
3767
|
this.setTitle(params.title);
|
|
3758
3768
|
this.setSuppressClosable(params.suppressClosable || false);
|
|
3759
|
-
if (params.state) {
|
|
3760
|
-
this.api.setState(params.state);
|
|
3761
|
-
}
|
|
3762
3769
|
(_a = this.view) === null || _a === void 0 ? void 0 : _a.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));
|
|
3763
3770
|
}
|
|
3764
3771
|
focus() {
|
|
3765
3772
|
this.api._onFocusEvent.fire();
|
|
3766
3773
|
}
|
|
3767
|
-
setDirty(isDirty) {
|
|
3768
|
-
this.api._onDidDirtyChange.fire(isDirty);
|
|
3769
|
-
}
|
|
3770
|
-
close() {
|
|
3771
|
-
if (this.api.tryClose) {
|
|
3772
|
-
return this.api.tryClose();
|
|
3773
|
-
}
|
|
3774
|
-
return Promise.resolve(true);
|
|
3775
|
-
}
|
|
3776
3774
|
toJSON() {
|
|
3777
|
-
const state = this.api.getState();
|
|
3778
3775
|
return {
|
|
3779
3776
|
id: this.id,
|
|
3780
3777
|
view: this.view.toJSON(),
|
|
3781
3778
|
params: Object.keys(this._params || {}).length > 0
|
|
3782
3779
|
? this._params
|
|
3783
3780
|
: undefined,
|
|
3784
|
-
state: state && Object.keys(state).length > 0 ? state : undefined,
|
|
3785
3781
|
suppressClosable: this.suppressClosable || undefined,
|
|
3786
3782
|
title: this.title,
|
|
3787
3783
|
};
|
|
@@ -3826,18 +3822,6 @@
|
|
|
3826
3822
|
var _a;
|
|
3827
3823
|
this._group = group;
|
|
3828
3824
|
this.api.group = group;
|
|
3829
|
-
this.mutableDisposable.value = this._group.model.onDidGroupChange((ev) => {
|
|
3830
|
-
var _a;
|
|
3831
|
-
if (ev.kind === exports.GroupChangeKind2.GROUP_ACTIVE) {
|
|
3832
|
-
const isVisible = !!((_a = this._group) === null || _a === void 0 ? void 0 : _a.model.isPanelActive(this));
|
|
3833
|
-
this.api._onDidActiveChange.fire({
|
|
3834
|
-
isActive: isGroupActive && isVisible,
|
|
3835
|
-
});
|
|
3836
|
-
this.api._onDidVisibilityChange.fire({
|
|
3837
|
-
isVisible,
|
|
3838
|
-
});
|
|
3839
|
-
}
|
|
3840
|
-
});
|
|
3841
3825
|
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
3842
3826
|
this.api._onDidActiveChange.fire({
|
|
3843
3827
|
isActive: isGroupActive && isPanelVisible,
|
|
@@ -3947,15 +3931,6 @@
|
|
|
3947
3931
|
}
|
|
3948
3932
|
}
|
|
3949
3933
|
|
|
3950
|
-
function debounce(cb, wait) {
|
|
3951
|
-
let timeout;
|
|
3952
|
-
const callable = (...args) => {
|
|
3953
|
-
clearTimeout(timeout);
|
|
3954
|
-
timeout = setTimeout(() => cb(...args), wait);
|
|
3955
|
-
};
|
|
3956
|
-
return callable;
|
|
3957
|
-
}
|
|
3958
|
-
|
|
3959
3934
|
class DefaultDeserializer {
|
|
3960
3935
|
constructor(layout, panelDeserializer) {
|
|
3961
3936
|
this.layout = layout;
|
|
@@ -4056,9 +4031,6 @@
|
|
|
4056
4031
|
this._isGroupActive = false;
|
|
4057
4032
|
//
|
|
4058
4033
|
this.params = {};
|
|
4059
|
-
//
|
|
4060
|
-
this.isDirtyDisposable = new MutableDisposable();
|
|
4061
|
-
this.addDisposables(this.isDirtyDisposable);
|
|
4062
4034
|
this._element = document.createElement('div');
|
|
4063
4035
|
this._element.className = 'default-tab';
|
|
4064
4036
|
//
|
|
@@ -4103,10 +4075,6 @@
|
|
|
4103
4075
|
init(params) {
|
|
4104
4076
|
this.params = params;
|
|
4105
4077
|
this._content.textContent = params.title;
|
|
4106
|
-
this.isDirtyDisposable.value = this.params.api.onDidDirtyChange((event) => {
|
|
4107
|
-
const isDirty = event;
|
|
4108
|
-
toggleClass(this.action, 'dirty', isDirty);
|
|
4109
|
-
});
|
|
4110
4078
|
if (!this.params.suppressClosable) {
|
|
4111
4079
|
addDisposableListener(this.action, 'click', (ev) => {
|
|
4112
4080
|
ev.preventDefault(); //
|
|
@@ -4160,6 +4128,10 @@
|
|
|
4160
4128
|
get height() {
|
|
4161
4129
|
return this._height;
|
|
4162
4130
|
}
|
|
4131
|
+
get params() {
|
|
4132
|
+
var _a;
|
|
4133
|
+
return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
|
|
4134
|
+
}
|
|
4163
4135
|
focus() {
|
|
4164
4136
|
this.api._onFocusEvent.fire();
|
|
4165
4137
|
}
|
|
@@ -4168,29 +4140,27 @@
|
|
|
4168
4140
|
this._height = height;
|
|
4169
4141
|
this.api._onDidPanelDimensionChange.fire({ width, height });
|
|
4170
4142
|
if (this.part) {
|
|
4171
|
-
if (this.
|
|
4172
|
-
this.part.update(this.
|
|
4143
|
+
if (this._params) {
|
|
4144
|
+
this.part.update(this._params.params);
|
|
4173
4145
|
}
|
|
4174
4146
|
}
|
|
4175
4147
|
}
|
|
4176
4148
|
init(parameters) {
|
|
4177
|
-
this.
|
|
4149
|
+
this._params = parameters;
|
|
4178
4150
|
this.part = this.getComponent();
|
|
4179
4151
|
}
|
|
4180
4152
|
update(event) {
|
|
4181
4153
|
var _a, _b;
|
|
4182
|
-
this.
|
|
4183
|
-
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this.
|
|
4154
|
+
this._params = Object.assign(Object.assign({}, this._params), { params: Object.assign(Object.assign({}, (_a = this._params) === null || _a === void 0 ? void 0 : _a.params), event.params) });
|
|
4155
|
+
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
|
|
4184
4156
|
}
|
|
4185
4157
|
toJSON() {
|
|
4186
4158
|
var _a, _b;
|
|
4187
|
-
const
|
|
4188
|
-
const params = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
|
|
4159
|
+
const params = (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
|
|
4189
4160
|
return {
|
|
4190
4161
|
id: this.id,
|
|
4191
4162
|
component: this.component,
|
|
4192
4163
|
params: Object.keys(params).length > 0 ? params : undefined,
|
|
4193
|
-
state: Object.keys(state).length === 0 ? undefined : state,
|
|
4194
4164
|
};
|
|
4195
4165
|
}
|
|
4196
4166
|
dispose() {
|
|
@@ -4213,12 +4183,12 @@
|
|
|
4213
4183
|
this._snap = false;
|
|
4214
4184
|
this._onDidChange = new Emitter();
|
|
4215
4185
|
this.onDidChange = this._onDidChange.event;
|
|
4216
|
-
this.addDisposables(this.api.onVisibilityChange((event) => {
|
|
4186
|
+
this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
|
|
4217
4187
|
const { isVisible } = event;
|
|
4218
|
-
const { containerApi } = this.
|
|
4188
|
+
const { containerApi } = this._params;
|
|
4219
4189
|
containerApi.setVisible(this, isVisible);
|
|
4220
4190
|
}), this.api.onActiveChange(() => {
|
|
4221
|
-
const { containerApi } = this.
|
|
4191
|
+
const { containerApi } = this._params;
|
|
4222
4192
|
containerApi.setActive(this);
|
|
4223
4193
|
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
4224
4194
|
if (typeof event.minimumWidth === 'number' ||
|
|
@@ -4333,9 +4303,6 @@
|
|
|
4333
4303
|
const minimum = (value) => (value <= 0 ? undefined : value);
|
|
4334
4304
|
return Object.assign(Object.assign({}, state), { minimumHeight: minimum(this.minimumHeight), maximumHeight: maximum(this.maximumHeight), minimumWidth: minimum(this.minimumWidth), maximumWidth: maximum(this.maximumWidth), snap: this.snap, priority: this.priority });
|
|
4335
4305
|
}
|
|
4336
|
-
dispose() {
|
|
4337
|
-
super.dispose();
|
|
4338
|
-
}
|
|
4339
4306
|
}
|
|
4340
4307
|
|
|
4341
4308
|
class GroupviewPanel extends GridviewPanel {
|
|
@@ -4407,7 +4374,9 @@
|
|
|
4407
4374
|
this.tab.init(params);
|
|
4408
4375
|
}
|
|
4409
4376
|
updateParentGroup(group, isPanelVisible) {
|
|
4410
|
-
|
|
4377
|
+
var _a;
|
|
4378
|
+
this._content.updateParentGroup(group, isPanelVisible);
|
|
4379
|
+
(_a = this._tab) === null || _a === void 0 ? void 0 : _a.updateParentGroup(group, isPanelVisible);
|
|
4411
4380
|
}
|
|
4412
4381
|
layout(width, height) {
|
|
4413
4382
|
this.content.layout(width, height);
|
|
@@ -4440,15 +4409,22 @@
|
|
|
4440
4409
|
orientation: options.orientation || exports.Orientation.HORIZONTAL,
|
|
4441
4410
|
styles: options.styles,
|
|
4442
4411
|
});
|
|
4443
|
-
this._panels = new Map();
|
|
4444
|
-
this.dirtyPanels = new Set();
|
|
4445
|
-
this.debouncedDeque = debounce(this.syncConfigs.bind(this), 5000);
|
|
4446
4412
|
// events
|
|
4447
4413
|
this._onTabInteractionEvent = new Emitter();
|
|
4448
4414
|
this.onTabInteractionEvent = this._onTabInteractionEvent.event;
|
|
4449
4415
|
this._onTabContextMenu = new Emitter();
|
|
4450
4416
|
this.onTabContextMenu = this._onTabContextMenu.event;
|
|
4451
|
-
this.
|
|
4417
|
+
this._onDidDrop = new Emitter();
|
|
4418
|
+
this.onDidDrop = this._onDidDrop.event;
|
|
4419
|
+
this._onDidRemovePanel = new Emitter();
|
|
4420
|
+
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
4421
|
+
this._onDidAddPanel = new Emitter();
|
|
4422
|
+
this.onDidAddPanel = this._onDidAddPanel.event;
|
|
4423
|
+
this._onDidLayoutfromJSON = new Emitter();
|
|
4424
|
+
this.onDidLayoutfromJSON = this._onDidLayoutfromJSON.event;
|
|
4425
|
+
this._onDidActivePanelChange = new Emitter();
|
|
4426
|
+
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
4427
|
+
this.addDisposables(this._onTabInteractionEvent, this._onTabContextMenu, this._onDidDrop);
|
|
4452
4428
|
this._options = options;
|
|
4453
4429
|
if (!this.options.components) {
|
|
4454
4430
|
this.options.components = {};
|
|
@@ -4469,10 +4445,10 @@
|
|
|
4469
4445
|
this._api = new DockviewApi(this);
|
|
4470
4446
|
}
|
|
4471
4447
|
get totalPanels() {
|
|
4472
|
-
return this.
|
|
4448
|
+
return this.panels.length;
|
|
4473
4449
|
}
|
|
4474
4450
|
get panels() {
|
|
4475
|
-
return
|
|
4451
|
+
return this.groups.flatMap((group) => group.model.panels);
|
|
4476
4452
|
}
|
|
4477
4453
|
get deserializer() {
|
|
4478
4454
|
return this._deserializer;
|
|
@@ -4502,10 +4478,6 @@
|
|
|
4502
4478
|
updateOptions(options) {
|
|
4503
4479
|
const hasOrientationChanged = typeof options.orientation === 'string' &&
|
|
4504
4480
|
this.options.orientation !== options.orientation;
|
|
4505
|
-
// TODO support style update
|
|
4506
|
-
// const hasStylesChanged =
|
|
4507
|
-
// typeof options.styles === 'object' &&
|
|
4508
|
-
// this.options.styles !== options.styles;
|
|
4509
4481
|
this._options = Object.assign(Object.assign({}, this.options), options);
|
|
4510
4482
|
if (hasOrientationChanged) {
|
|
4511
4483
|
this.gridview.orientation = options.orientation;
|
|
@@ -4517,8 +4489,7 @@
|
|
|
4517
4489
|
(_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
|
|
4518
4490
|
}
|
|
4519
4491
|
getGroupPanel(id) {
|
|
4520
|
-
|
|
4521
|
-
return (_a = this._panels.get(id)) === null || _a === void 0 ? void 0 : _a.value;
|
|
4492
|
+
return this.panels.find((panel) => panel.id === id);
|
|
4522
4493
|
}
|
|
4523
4494
|
setActivePanel(panel) {
|
|
4524
4495
|
if (!panel.group) {
|
|
@@ -4567,24 +4538,6 @@
|
|
|
4567
4538
|
this.doSetGroupActive(next);
|
|
4568
4539
|
}
|
|
4569
4540
|
}
|
|
4570
|
-
registerPanel(panel) {
|
|
4571
|
-
if (this._panels.has(panel.id)) {
|
|
4572
|
-
throw new Error(`panel ${panel.id} already exists`);
|
|
4573
|
-
}
|
|
4574
|
-
const disposable = new CompositeDisposable(panel.onDidStateChange(() => this.addDirtyPanel(panel)));
|
|
4575
|
-
this._panels.set(panel.id, { value: panel, disposable });
|
|
4576
|
-
}
|
|
4577
|
-
unregisterPanel(panel) {
|
|
4578
|
-
if (!this._panels.has(panel.id)) {
|
|
4579
|
-
throw new Error(`panel ${panel.id} doesn't exist`);
|
|
4580
|
-
}
|
|
4581
|
-
const item = this._panels.get(panel.id);
|
|
4582
|
-
if (item) {
|
|
4583
|
-
item.disposable.dispose();
|
|
4584
|
-
item.value.dispose();
|
|
4585
|
-
}
|
|
4586
|
-
this._panels.delete(panel.id);
|
|
4587
|
-
}
|
|
4588
4541
|
/**
|
|
4589
4542
|
* Serialize the current state of the layout
|
|
4590
4543
|
*
|
|
@@ -4592,12 +4545,9 @@
|
|
|
4592
4545
|
*/
|
|
4593
4546
|
toJSON() {
|
|
4594
4547
|
var _a;
|
|
4595
|
-
this.syncConfigs();
|
|
4596
4548
|
const data = this.gridview.serialize();
|
|
4597
|
-
const panels =
|
|
4598
|
-
|
|
4599
|
-
collection[panel.value.id] = panel.value.toJSON();
|
|
4600
|
-
}
|
|
4549
|
+
const panels = this.panels.reduce((collection, panel) => {
|
|
4550
|
+
collection[panel.id] = panel.toJSON();
|
|
4601
4551
|
return collection;
|
|
4602
4552
|
}, {});
|
|
4603
4553
|
return {
|
|
@@ -4609,11 +4559,9 @@
|
|
|
4609
4559
|
}
|
|
4610
4560
|
fromJSON(data) {
|
|
4611
4561
|
this.gridview.clear();
|
|
4612
|
-
this.
|
|
4613
|
-
panel.
|
|
4614
|
-
panel.value.dispose();
|
|
4562
|
+
this.panels.forEach((panel) => {
|
|
4563
|
+
panel.dispose();
|
|
4615
4564
|
});
|
|
4616
|
-
this._panels.clear();
|
|
4617
4565
|
this._groups.clear();
|
|
4618
4566
|
if (!this.deserializer) {
|
|
4619
4567
|
throw new Error('invalid deserializer');
|
|
@@ -4628,9 +4576,7 @@
|
|
|
4628
4576
|
this.gridview.deserialize(grid, new DefaultDeserializer(this, {
|
|
4629
4577
|
createPanel: (id) => {
|
|
4630
4578
|
const panelData = panels[id];
|
|
4631
|
-
|
|
4632
|
-
this.registerPanel(panel);
|
|
4633
|
-
return panel;
|
|
4579
|
+
return this.deserializer.fromJSON(panelData);
|
|
4634
4580
|
},
|
|
4635
4581
|
}));
|
|
4636
4582
|
if (typeof activeGroup === 'string') {
|
|
@@ -4641,30 +4587,23 @@
|
|
|
4641
4587
|
}
|
|
4642
4588
|
this.gridview.layout(this.width, this.height);
|
|
4643
4589
|
this._onGridEvent.fire({ kind: exports.GroupChangeKind.LAYOUT_FROM_JSON });
|
|
4590
|
+
this._onDidLayoutfromJSON.fire();
|
|
4644
4591
|
}
|
|
4645
4592
|
closeAllGroups() {
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
if (!didCloseAll) {
|
|
4651
|
-
return false;
|
|
4652
|
-
}
|
|
4653
|
-
}
|
|
4654
|
-
return true;
|
|
4655
|
-
});
|
|
4593
|
+
for (const entry of this._groups.entries()) {
|
|
4594
|
+
const [_, group] = entry;
|
|
4595
|
+
group.value.model.closeAllPanels();
|
|
4596
|
+
}
|
|
4656
4597
|
}
|
|
4657
4598
|
fireMouseEvent(event) {
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
}
|
|
4667
|
-
break;
|
|
4599
|
+
if (event.kind === exports.MouseEventKind.CONTEXT_MENU) {
|
|
4600
|
+
if (event.tab && event.panel) {
|
|
4601
|
+
this._onTabContextMenu.fire({
|
|
4602
|
+
event: event.event,
|
|
4603
|
+
api: this._api,
|
|
4604
|
+
panel: event.panel,
|
|
4605
|
+
});
|
|
4606
|
+
}
|
|
4668
4607
|
}
|
|
4669
4608
|
}
|
|
4670
4609
|
addPanel(options) {
|
|
@@ -4698,7 +4637,6 @@
|
|
|
4698
4637
|
return panel;
|
|
4699
4638
|
}
|
|
4700
4639
|
removePanel(panel) {
|
|
4701
|
-
this.unregisterPanel(panel);
|
|
4702
4640
|
const group = panel.group;
|
|
4703
4641
|
if (!group) {
|
|
4704
4642
|
throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
|
|
@@ -4717,10 +4655,9 @@
|
|
|
4717
4655
|
: {}, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.watermark);
|
|
4718
4656
|
}
|
|
4719
4657
|
addEmptyGroup(options) {
|
|
4720
|
-
var _a;
|
|
4721
4658
|
const group = this.createGroup();
|
|
4722
4659
|
if (options) {
|
|
4723
|
-
const referencePanel =
|
|
4660
|
+
const referencePanel = this.panels.find((panel) => panel.id === options.referencePanel);
|
|
4724
4661
|
if (!referencePanel) {
|
|
4725
4662
|
throw new Error(`reference panel ${options.referencePanel} does not exist`);
|
|
4726
4663
|
}
|
|
@@ -4749,13 +4686,13 @@
|
|
|
4749
4686
|
super.removeGroup(group);
|
|
4750
4687
|
}
|
|
4751
4688
|
moveGroupOrPanel(referenceGroup, groupId, itemId, target, index) {
|
|
4752
|
-
var _a
|
|
4689
|
+
var _a;
|
|
4753
4690
|
const sourceGroup = groupId
|
|
4754
4691
|
? (_a = this._groups.get(groupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
4755
4692
|
: undefined;
|
|
4756
4693
|
if (!target || target === exports.Position.Center) {
|
|
4757
4694
|
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(itemId)) ||
|
|
4758
|
-
|
|
4695
|
+
this.panels.find((panel) => panel.id === itemId);
|
|
4759
4696
|
if (!groupItem) {
|
|
4760
4697
|
throw new Error(`No panel with id ${itemId}`);
|
|
4761
4698
|
}
|
|
@@ -4791,7 +4728,7 @@
|
|
|
4791
4728
|
}
|
|
4792
4729
|
else {
|
|
4793
4730
|
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(itemId)) ||
|
|
4794
|
-
|
|
4731
|
+
this.panels.find((panel) => panel.id === itemId);
|
|
4795
4732
|
if (!groupItem) {
|
|
4796
4733
|
throw new Error(`No panel with id ${itemId}`);
|
|
4797
4734
|
}
|
|
@@ -4801,7 +4738,7 @@
|
|
|
4801
4738
|
}
|
|
4802
4739
|
}
|
|
4803
4740
|
doSetGroupActive(group, skipFocus) {
|
|
4804
|
-
var _a, _b;
|
|
4741
|
+
var _a, _b, _c;
|
|
4805
4742
|
const isGroupAlreadyFocused = this._activeGroup === group;
|
|
4806
4743
|
super.doSetGroupActive(group, skipFocus);
|
|
4807
4744
|
if (!isGroupAlreadyFocused && ((_a = this._activeGroup) === null || _a === void 0 ? void 0 : _a.model.activePanel)) {
|
|
@@ -4809,6 +4746,7 @@
|
|
|
4809
4746
|
kind: exports.GroupChangeKind.PANEL_ACTIVE,
|
|
4810
4747
|
panel: (_b = this._activeGroup) === null || _b === void 0 ? void 0 : _b.model.activePanel,
|
|
4811
4748
|
});
|
|
4749
|
+
this._onDidActivePanelChange.fire((_c = this._activeGroup) === null || _c === void 0 ? void 0 : _c.model.activePanel);
|
|
4812
4750
|
}
|
|
4813
4751
|
}
|
|
4814
4752
|
createGroup(options) {
|
|
@@ -4834,6 +4772,8 @@
|
|
|
4834
4772
|
const disposable = new CompositeDisposable(view.model.onMove((event) => {
|
|
4835
4773
|
const { groupId, itemId, target, index } = event;
|
|
4836
4774
|
this.moveGroupOrPanel(view, groupId, itemId, target, index);
|
|
4775
|
+
}), view.model.onDidDrop((event) => {
|
|
4776
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api }));
|
|
4837
4777
|
}), view.model.onDidGroupChange((event) => {
|
|
4838
4778
|
switch (event.kind) {
|
|
4839
4779
|
case exports.GroupChangeKind2.ADD_PANEL:
|
|
@@ -4841,24 +4781,25 @@
|
|
|
4841
4781
|
kind: exports.GroupChangeKind.ADD_PANEL,
|
|
4842
4782
|
panel: event.panel,
|
|
4843
4783
|
});
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
kind: exports.GroupChangeKind.GROUP_ACTIVE,
|
|
4848
|
-
panel: event.panel,
|
|
4849
|
-
});
|
|
4784
|
+
if (event.panel) {
|
|
4785
|
+
this._onDidAddPanel.fire(event.panel);
|
|
4786
|
+
}
|
|
4850
4787
|
break;
|
|
4851
4788
|
case exports.GroupChangeKind2.REMOVE_PANEL:
|
|
4852
4789
|
this._onGridEvent.fire({
|
|
4853
4790
|
kind: exports.GroupChangeKind.REMOVE_PANEL,
|
|
4854
4791
|
panel: event.panel,
|
|
4855
4792
|
});
|
|
4793
|
+
if (event.panel) {
|
|
4794
|
+
this._onDidRemovePanel.fire(event.panel);
|
|
4795
|
+
}
|
|
4856
4796
|
break;
|
|
4857
4797
|
case exports.GroupChangeKind2.PANEL_ACTIVE:
|
|
4858
4798
|
this._onGridEvent.fire({
|
|
4859
4799
|
kind: exports.GroupChangeKind.PANEL_ACTIVE,
|
|
4860
4800
|
panel: event.panel,
|
|
4861
4801
|
});
|
|
4802
|
+
this._onDidActivePanelChange.fire(event.panel);
|
|
4862
4803
|
break;
|
|
4863
4804
|
}
|
|
4864
4805
|
}));
|
|
@@ -4872,44 +4813,18 @@
|
|
|
4872
4813
|
}
|
|
4873
4814
|
return view;
|
|
4874
4815
|
}
|
|
4875
|
-
dispose() {
|
|
4876
|
-
super.dispose();
|
|
4877
|
-
this._onGridEvent.dispose();
|
|
4878
|
-
}
|
|
4879
|
-
/**
|
|
4880
|
-
* Ensure the local copy of the layout state is up-to-date
|
|
4881
|
-
*/
|
|
4882
|
-
syncConfigs() {
|
|
4883
|
-
const dirtyPanels = Array.from(this.dirtyPanels);
|
|
4884
|
-
if (dirtyPanels.length === 0) ;
|
|
4885
|
-
this.dirtyPanels.clear();
|
|
4886
|
-
const partialPanelState = dirtyPanels
|
|
4887
|
-
.map((panel) => this._panels.get(panel.id))
|
|
4888
|
-
.filter((_) => !!_)
|
|
4889
|
-
.reduce((collection, panel) => {
|
|
4890
|
-
collection[panel.value.id] = panel.value.toJSON();
|
|
4891
|
-
return collection;
|
|
4892
|
-
}, {});
|
|
4893
|
-
this.panelState = Object.assign(Object.assign({}, this.panelState), partialPanelState);
|
|
4894
|
-
dirtyPanels
|
|
4895
|
-
.filter((p) => this._panels.has(p.id))
|
|
4896
|
-
.forEach((panel) => {
|
|
4897
|
-
panel.setDirty(false);
|
|
4898
|
-
});
|
|
4899
|
-
}
|
|
4900
4816
|
_addPanel(options) {
|
|
4901
4817
|
const view = new DefaultGroupPanelView({
|
|
4902
4818
|
content: this.createContentComponent(options.id, options.component),
|
|
4903
4819
|
tab: this.createTabComponent(options.id, options.tabComponent),
|
|
4904
4820
|
});
|
|
4905
|
-
const panel = new DockviewGroupPanel(options.id, this._api);
|
|
4821
|
+
const panel = new DockviewGroupPanel(options.id, this, this._api);
|
|
4906
4822
|
panel.init({
|
|
4907
4823
|
view,
|
|
4908
4824
|
title: options.title || options.id,
|
|
4909
4825
|
suppressClosable: options === null || options === void 0 ? void 0 : options.suppressClosable,
|
|
4910
4826
|
params: (options === null || options === void 0 ? void 0 : options.params) || {},
|
|
4911
4827
|
});
|
|
4912
|
-
this.registerPanel(panel);
|
|
4913
4828
|
return panel;
|
|
4914
4829
|
}
|
|
4915
4830
|
createContentComponent(id, componentName) {
|
|
@@ -4929,10 +4844,12 @@
|
|
|
4929
4844
|
var _a;
|
|
4930
4845
|
return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
|
|
4931
4846
|
}
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
this.
|
|
4847
|
+
dispose() {
|
|
4848
|
+
super.dispose();
|
|
4849
|
+
this._onDidActivePanelChange.dispose();
|
|
4850
|
+
this._onDidAddPanel.dispose();
|
|
4851
|
+
this._onDidRemovePanel.dispose();
|
|
4852
|
+
this._onDidLayoutfromJSON.dispose();
|
|
4936
4853
|
}
|
|
4937
4854
|
}
|
|
4938
4855
|
|
|
@@ -4943,6 +4860,8 @@
|
|
|
4943
4860
|
orientation: options.orientation,
|
|
4944
4861
|
styles: options.styles,
|
|
4945
4862
|
});
|
|
4863
|
+
this._onDidLayoutfromJSON = new Emitter();
|
|
4864
|
+
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
4946
4865
|
this._options = options;
|
|
4947
4866
|
if (!this.options.components) {
|
|
4948
4867
|
this.options.components = {};
|
|
@@ -5051,6 +4970,7 @@
|
|
|
5051
4970
|
}
|
|
5052
4971
|
}
|
|
5053
4972
|
this._onGridEvent.fire({ kind: exports.GroupChangeKind.LAYOUT_FROM_JSON });
|
|
4973
|
+
this._onDidLayoutfromJSON.fire();
|
|
5054
4974
|
}
|
|
5055
4975
|
movePanel(panel, options) {
|
|
5056
4976
|
var _a;
|
|
@@ -5165,6 +5085,7 @@
|
|
|
5165
5085
|
}
|
|
5166
5086
|
dispose() {
|
|
5167
5087
|
super.dispose();
|
|
5088
|
+
this._onDidLayoutfromJSON.dispose();
|
|
5168
5089
|
}
|
|
5169
5090
|
}
|
|
5170
5091
|
|
|
@@ -5177,6 +5098,10 @@
|
|
|
5177
5098
|
this.element = element;
|
|
5178
5099
|
this._disposable = new MutableDisposable();
|
|
5179
5100
|
this.panels = new Map();
|
|
5101
|
+
this._onDidAddView = new Emitter();
|
|
5102
|
+
this.onDidAddView = this._onDidAddView.event;
|
|
5103
|
+
this._onDidRemoveView = new Emitter();
|
|
5104
|
+
this.onDidRemoveView = this._onDidRemoveView.event;
|
|
5180
5105
|
this._onDidLayoutChange = new Emitter();
|
|
5181
5106
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
5182
5107
|
this._options = options;
|
|
@@ -5187,7 +5112,7 @@
|
|
|
5187
5112
|
options.frameworkComponents = {};
|
|
5188
5113
|
}
|
|
5189
5114
|
this.splitview = new Splitview(this.element, options);
|
|
5190
|
-
this.addDisposables(this._disposable);
|
|
5115
|
+
this.addDisposables(this._disposable, this._onDidAddView, this._onDidRemoveView, this._onDidLayoutChange);
|
|
5191
5116
|
}
|
|
5192
5117
|
get options() {
|
|
5193
5118
|
return this._options;
|
|
@@ -5202,7 +5127,7 @@
|
|
|
5202
5127
|
this._splitview = value;
|
|
5203
5128
|
this._disposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
|
|
5204
5129
|
this._onDidLayoutChange.fire(undefined);
|
|
5205
|
-
}));
|
|
5130
|
+
}), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
|
|
5206
5131
|
}
|
|
5207
5132
|
get minimumSize() {
|
|
5208
5133
|
return this.splitview.minimumSize;
|
|
@@ -5376,6 +5301,10 @@
|
|
|
5376
5301
|
});
|
|
5377
5302
|
panel.orientation = orientation;
|
|
5378
5303
|
this.doAddView(panel);
|
|
5304
|
+
setTimeout(() => {
|
|
5305
|
+
// the original onDidAddView events are missed since they are fired before we can subcribe to them
|
|
5306
|
+
this._onDidAddView.fire(panel);
|
|
5307
|
+
}, 0);
|
|
5379
5308
|
return { size: view.size, view: panel };
|
|
5380
5309
|
}),
|
|
5381
5310
|
},
|
|
@@ -5405,41 +5334,6 @@
|
|
|
5405
5334
|
}
|
|
5406
5335
|
}
|
|
5407
5336
|
|
|
5408
|
-
class DragHandler extends CompositeDisposable {
|
|
5409
|
-
constructor(el) {
|
|
5410
|
-
super();
|
|
5411
|
-
this.el = el;
|
|
5412
|
-
this.iframes = [];
|
|
5413
|
-
this._onDragStart = new Emitter();
|
|
5414
|
-
this.onDragStart = this._onDragStart.event;
|
|
5415
|
-
this.configure();
|
|
5416
|
-
}
|
|
5417
|
-
configure() {
|
|
5418
|
-
this.addDisposables(addDisposableListener(this.el, 'dragstart', (event) => {
|
|
5419
|
-
var _a;
|
|
5420
|
-
this.iframes = [
|
|
5421
|
-
...getElementsByTagName('iframe'),
|
|
5422
|
-
...getElementsByTagName('webview'),
|
|
5423
|
-
];
|
|
5424
|
-
for (const iframe of this.iframes) {
|
|
5425
|
-
iframe.style.pointerEvents = 'none';
|
|
5426
|
-
}
|
|
5427
|
-
this.el.classList.add('dragged');
|
|
5428
|
-
setTimeout(() => this.el.classList.remove('dragged'), 0);
|
|
5429
|
-
(_a = this.disposable) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
5430
|
-
this.disposable = this.getData();
|
|
5431
|
-
}), addDisposableListener(this.el, 'dragend', (ev) => {
|
|
5432
|
-
var _a;
|
|
5433
|
-
for (const iframe of this.iframes) {
|
|
5434
|
-
iframe.style.pointerEvents = 'auto';
|
|
5435
|
-
}
|
|
5436
|
-
this.iframes = [];
|
|
5437
|
-
(_a = this.disposable) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
5438
|
-
this.disposable = undefined;
|
|
5439
|
-
}));
|
|
5440
|
-
}
|
|
5441
|
-
}
|
|
5442
|
-
|
|
5443
5337
|
class SplitviewPanelApiImpl extends PanelApiImpl {
|
|
5444
5338
|
//
|
|
5445
5339
|
constructor(id) {
|
|
@@ -5454,6 +5348,7 @@
|
|
|
5454
5348
|
//
|
|
5455
5349
|
this._onDidSizeChange = new Emitter();
|
|
5456
5350
|
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
5351
|
+
this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
|
|
5457
5352
|
}
|
|
5458
5353
|
setConstraints(value) {
|
|
5459
5354
|
this._onDidConstraintsChangeInternal.fire(value);
|
|
@@ -5461,11 +5356,6 @@
|
|
|
5461
5356
|
setSize(event) {
|
|
5462
5357
|
this._onDidSizeChange.fire(event);
|
|
5463
5358
|
}
|
|
5464
|
-
dispose() {
|
|
5465
|
-
super.dispose();
|
|
5466
|
-
this._onDidConstraintsChange.dispose();
|
|
5467
|
-
this._onDidSizeChange.dispose();
|
|
5468
|
-
}
|
|
5469
5359
|
}
|
|
5470
5360
|
|
|
5471
5361
|
class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
|
|
@@ -5479,6 +5369,7 @@
|
|
|
5479
5369
|
this.onMouseEnter = this._onMouseEnter.event;
|
|
5480
5370
|
this._onMouseLeave = new Emitter({});
|
|
5481
5371
|
this.onMouseLeave = this._onMouseLeave.event;
|
|
5372
|
+
this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
|
|
5482
5373
|
}
|
|
5483
5374
|
set pane(pane) {
|
|
5484
5375
|
this._pane = pane;
|
|
@@ -5494,7 +5385,7 @@
|
|
|
5494
5385
|
}
|
|
5495
5386
|
|
|
5496
5387
|
class PaneviewPanel extends BasePanelView {
|
|
5497
|
-
constructor(id, component, headerComponent, orientation, isExpanded) {
|
|
5388
|
+
constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
|
|
5498
5389
|
super(id, component, new PaneviewPanelApiImpl(id));
|
|
5499
5390
|
this.headerComponent = headerComponent;
|
|
5500
5391
|
this._onDidChangeExpansionState = new Emitter({ replay: true });
|
|
@@ -5510,6 +5401,7 @@
|
|
|
5510
5401
|
this.expandedSize = 0;
|
|
5511
5402
|
this.api.pane = this; // TODO cannot use 'this' before 'super'
|
|
5512
5403
|
this._isExpanded = isExpanded;
|
|
5404
|
+
this._headerVisible = isHeaderVisible;
|
|
5513
5405
|
this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
|
|
5514
5406
|
this._orientation = orientation;
|
|
5515
5407
|
this.element.classList.add('pane');
|
|
@@ -5577,6 +5469,13 @@
|
|
|
5577
5469
|
this._maximumBodySize =
|
|
5578
5470
|
typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
|
|
5579
5471
|
}
|
|
5472
|
+
get headerVisible() {
|
|
5473
|
+
return this._headerVisible;
|
|
5474
|
+
}
|
|
5475
|
+
set headerVisible(value) {
|
|
5476
|
+
this._headerVisible = value;
|
|
5477
|
+
this.header.style.display = value ? '' : 'none';
|
|
5478
|
+
}
|
|
5580
5479
|
setVisible(isVisible) {
|
|
5581
5480
|
this.api._onDidVisibilityChange.fire({ isVisible });
|
|
5582
5481
|
}
|
|
@@ -5639,7 +5538,7 @@
|
|
|
5639
5538
|
}
|
|
5640
5539
|
}
|
|
5641
5540
|
toJSON() {
|
|
5642
|
-
const params = this.
|
|
5541
|
+
const params = this._params;
|
|
5643
5542
|
return Object.assign(Object.assign({}, super.toJSON()), { headerComponent: this.headerComponent, title: params.title });
|
|
5644
5543
|
}
|
|
5645
5544
|
renderOnce() {
|
|
@@ -5674,7 +5573,7 @@
|
|
|
5674
5573
|
|
|
5675
5574
|
class DraggablePaneviewPanel extends PaneviewPanel {
|
|
5676
5575
|
constructor(id, component, headerComponent, orientation, isExpanded, disableDnd) {
|
|
5677
|
-
super(id, component, headerComponent, orientation, isExpanded);
|
|
5576
|
+
super(id, component, headerComponent, orientation, isExpanded, true);
|
|
5678
5577
|
this._onDidDrop = new Emitter();
|
|
5679
5578
|
this.onDidDrop = this._onDidDrop.event;
|
|
5680
5579
|
if (!disableDnd) {
|
|
@@ -5708,36 +5607,39 @@
|
|
|
5708
5607
|
},
|
|
5709
5608
|
});
|
|
5710
5609
|
this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
|
|
5711
|
-
|
|
5712
|
-
if (!data) {
|
|
5713
|
-
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: () => getPaneData() }));
|
|
5714
|
-
return;
|
|
5715
|
-
}
|
|
5716
|
-
const containerApi = this.params
|
|
5717
|
-
.containerApi;
|
|
5718
|
-
const panelId = data.paneId;
|
|
5719
|
-
const existingPanel = containerApi.getPanel(panelId);
|
|
5720
|
-
if (!existingPanel) {
|
|
5721
|
-
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: () => getPaneData() }));
|
|
5722
|
-
return;
|
|
5723
|
-
}
|
|
5724
|
-
const allPanels = containerApi.getPanels();
|
|
5725
|
-
const fromIndex = allPanels.indexOf(existingPanel);
|
|
5726
|
-
let toIndex = containerApi.getPanels().indexOf(this);
|
|
5727
|
-
if (event.position === exports.Position.Left ||
|
|
5728
|
-
event.position === exports.Position.Top) {
|
|
5729
|
-
toIndex = Math.max(0, toIndex - 1);
|
|
5730
|
-
}
|
|
5731
|
-
if (event.position === exports.Position.Right ||
|
|
5732
|
-
event.position === exports.Position.Bottom) {
|
|
5733
|
-
if (fromIndex > toIndex) {
|
|
5734
|
-
toIndex++;
|
|
5735
|
-
}
|
|
5736
|
-
toIndex = Math.min(allPanels.length - 1, toIndex);
|
|
5737
|
-
}
|
|
5738
|
-
containerApi.movePanel(fromIndex, toIndex);
|
|
5610
|
+
this.onDrop(event);
|
|
5739
5611
|
}));
|
|
5740
5612
|
}
|
|
5613
|
+
onDrop(event) {
|
|
5614
|
+
const data = getPaneData();
|
|
5615
|
+
if (!data) {
|
|
5616
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: () => getPaneData() }));
|
|
5617
|
+
return;
|
|
5618
|
+
}
|
|
5619
|
+
const containerApi = this._params
|
|
5620
|
+
.containerApi;
|
|
5621
|
+
const panelId = data.paneId;
|
|
5622
|
+
const existingPanel = containerApi.getPanel(panelId);
|
|
5623
|
+
if (!existingPanel) {
|
|
5624
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: () => getPaneData() }));
|
|
5625
|
+
return;
|
|
5626
|
+
}
|
|
5627
|
+
const allPanels = containerApi.getPanels();
|
|
5628
|
+
const fromIndex = allPanels.indexOf(existingPanel);
|
|
5629
|
+
let toIndex = containerApi.getPanels().indexOf(this);
|
|
5630
|
+
if (event.position === exports.Position.Left ||
|
|
5631
|
+
event.position === exports.Position.Top) {
|
|
5632
|
+
toIndex = Math.max(0, toIndex - 1);
|
|
5633
|
+
}
|
|
5634
|
+
if (event.position === exports.Position.Right ||
|
|
5635
|
+
event.position === exports.Position.Bottom) {
|
|
5636
|
+
if (fromIndex > toIndex) {
|
|
5637
|
+
toIndex++;
|
|
5638
|
+
}
|
|
5639
|
+
toIndex = Math.min(allPanels.length - 1, toIndex);
|
|
5640
|
+
}
|
|
5641
|
+
containerApi.movePanel(fromIndex, toIndex);
|
|
5642
|
+
}
|
|
5741
5643
|
}
|
|
5742
5644
|
|
|
5743
5645
|
class DefaultHeader extends CompositeDisposable {
|
|
@@ -5797,6 +5699,11 @@
|
|
|
5797
5699
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
5798
5700
|
this._onDidDrop = new Emitter();
|
|
5799
5701
|
this.onDidDrop = this._onDidDrop.event;
|
|
5702
|
+
this._onDidAddView = new Emitter();
|
|
5703
|
+
this.onDidAddView = this._onDidAddView.event;
|
|
5704
|
+
this._onDidRemoveView = new Emitter();
|
|
5705
|
+
this.onDidRemoveView = this._onDidRemoveView.event;
|
|
5706
|
+
this.addDisposables(this._onDidLayoutChange, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
|
|
5800
5707
|
this._options = options;
|
|
5801
5708
|
if (!options.components) {
|
|
5802
5709
|
options.components = {};
|
|
@@ -5810,17 +5717,11 @@
|
|
|
5810
5717
|
});
|
|
5811
5718
|
this.addDisposables(this._disposable);
|
|
5812
5719
|
}
|
|
5813
|
-
get onDidAddView() {
|
|
5814
|
-
return this._paneview.onDidAddView;
|
|
5815
|
-
}
|
|
5816
|
-
get onDidRemoveView() {
|
|
5817
|
-
return this._paneview.onDidRemoveView;
|
|
5818
|
-
}
|
|
5819
5720
|
set paneview(value) {
|
|
5820
5721
|
this._paneview = value;
|
|
5821
|
-
this._disposable.value = new CompositeDisposable(this.
|
|
5722
|
+
this._disposable.value = new CompositeDisposable(this._paneview.onDidChange(() => {
|
|
5822
5723
|
this._onDidLayoutChange.fire(undefined);
|
|
5823
|
-
}));
|
|
5724
|
+
}), this._paneview.onDidAddView((e) => this._onDidAddView.fire(e)), this._paneview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
|
|
5824
5725
|
}
|
|
5825
5726
|
get paneview() {
|
|
5826
5727
|
return this._paneview;
|
|
@@ -6000,6 +5901,10 @@
|
|
|
6000
5901
|
});
|
|
6001
5902
|
panel.orientation = this.paneview.orientation;
|
|
6002
5903
|
});
|
|
5904
|
+
setTimeout(() => {
|
|
5905
|
+
// the original onDidAddView events are missed since they are fired before we can subcribe to them
|
|
5906
|
+
this._onDidAddView.fire(panel);
|
|
5907
|
+
}, 0);
|
|
6003
5908
|
return { size: view.size, view: panel };
|
|
6004
5909
|
}),
|
|
6005
5910
|
},
|
|
@@ -6026,12 +5931,14 @@
|
|
|
6026
5931
|
this._snap = false;
|
|
6027
5932
|
this._onDidChange = new Emitter();
|
|
6028
5933
|
this.onDidChange = this._onDidChange.event;
|
|
6029
|
-
this.addDisposables(this.api.onVisibilityChange((event) => {
|
|
5934
|
+
this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
|
|
6030
5935
|
const { isVisible } = event;
|
|
6031
|
-
const { containerApi } = this
|
|
5936
|
+
const { containerApi } = this
|
|
5937
|
+
._params;
|
|
6032
5938
|
containerApi.setVisible(this, isVisible);
|
|
6033
5939
|
}), this.api.onActiveChange(() => {
|
|
6034
|
-
const { containerApi } = this
|
|
5940
|
+
const { containerApi } = this
|
|
5941
|
+
._params;
|
|
6035
5942
|
containerApi.setActive(this);
|
|
6036
5943
|
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
6037
5944
|
if (typeof event.minimumSize === 'number' ||
|
|
@@ -6174,14 +6081,13 @@
|
|
|
6174
6081
|
if (this.disposed) {
|
|
6175
6082
|
throw new Error('invalid operation: resource is already disposed');
|
|
6176
6083
|
}
|
|
6177
|
-
// TODO use a better check for isReactFunctionalComponent
|
|
6178
6084
|
if (typeof this.component !== 'function') {
|
|
6179
6085
|
/**
|
|
6180
6086
|
* we know this isn't a React.FunctionComponent so throw an error here.
|
|
6181
6087
|
* if we do not intercept this the React library will throw a very obsure error
|
|
6182
6088
|
* for the same reason, at least at this point we will emit a sensible stacktrace.
|
|
6183
6089
|
*/
|
|
6184
|
-
throw new Error('
|
|
6090
|
+
throw new Error('Invalid Operation. dockview only supports React Functional Components.');
|
|
6185
6091
|
}
|
|
6186
6092
|
const bridgeComponent = React__namespace.createElement(React__namespace.forwardRef(ReactComponentBridge), {
|
|
6187
6093
|
component: this
|
|
@@ -6245,16 +6151,14 @@
|
|
|
6245
6151
|
this._onDidBlur = new Emitter();
|
|
6246
6152
|
this.onDidBlur = this._onDidBlur.event;
|
|
6247
6153
|
this._element = document.createElement('div');
|
|
6248
|
-
this._element.
|
|
6249
|
-
this._element.style.width = '100%';
|
|
6154
|
+
this._element.className = 'dockview-react-part';
|
|
6250
6155
|
// this.hostedContainer = new HostedContainer({
|
|
6251
6156
|
// id,
|
|
6252
6157
|
// });
|
|
6253
6158
|
// this.hostedContainer.onDidFocus(() => this._onDidFocus.fire());
|
|
6254
6159
|
// this.hostedContainer.onDidBlur(() => this._onDidBlur.fire());
|
|
6255
6160
|
this._actionsElement = document.createElement('div');
|
|
6256
|
-
this._actionsElement.
|
|
6257
|
-
this._actionsElement.style.width = '100%';
|
|
6161
|
+
this._actionsElement.className = 'dockview-react-part';
|
|
6258
6162
|
}
|
|
6259
6163
|
get element() {
|
|
6260
6164
|
return this._element;
|
|
@@ -6302,6 +6206,8 @@
|
|
|
6302
6206
|
}
|
|
6303
6207
|
dispose() {
|
|
6304
6208
|
var _a, _b;
|
|
6209
|
+
this._onDidFocus.dispose();
|
|
6210
|
+
this._onDidBlur.dispose();
|
|
6305
6211
|
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
6306
6212
|
// this.hostedContainer?.dispose();
|
|
6307
6213
|
(_b = this.actionsPart) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
@@ -6314,6 +6220,7 @@
|
|
|
6314
6220
|
this.component = component;
|
|
6315
6221
|
this.reactPortalStore = reactPortalStore;
|
|
6316
6222
|
this._element = document.createElement('div');
|
|
6223
|
+
this._element.className = 'dockview-react-part';
|
|
6317
6224
|
}
|
|
6318
6225
|
get element() {
|
|
6319
6226
|
return this._element;
|
|
@@ -6358,7 +6265,6 @@
|
|
|
6358
6265
|
const panelId = panelData.id;
|
|
6359
6266
|
const params = panelData.params;
|
|
6360
6267
|
const title = panelData.title;
|
|
6361
|
-
const state = panelData.state;
|
|
6362
6268
|
const suppressClosable = panelData.suppressClosable;
|
|
6363
6269
|
const viewData = panelData.view;
|
|
6364
6270
|
const view = new DefaultGroupPanelView({
|
|
@@ -6367,13 +6273,12 @@
|
|
|
6367
6273
|
? createComponent(viewData.tab.id, viewData.tab.id, this.layout.options.tabComponents, this.layout.options.frameworkTabComponents, (_c = this.layout.options.frameworkComponentFactory) === null || _c === void 0 ? void 0 : _c.tab)
|
|
6368
6274
|
: new DefaultTab(),
|
|
6369
6275
|
});
|
|
6370
|
-
const panel = new DockviewGroupPanel(panelId, new DockviewApi(this.layout));
|
|
6276
|
+
const panel = new DockviewGroupPanel(panelId, this.layout, new DockviewApi(this.layout));
|
|
6371
6277
|
panel.init({
|
|
6372
6278
|
view,
|
|
6373
6279
|
title,
|
|
6374
6280
|
suppressClosable,
|
|
6375
6281
|
params: params || {},
|
|
6376
|
-
state: state || {},
|
|
6377
6282
|
});
|
|
6378
6283
|
return panel;
|
|
6379
6284
|
}
|
|
@@ -6388,8 +6293,7 @@
|
|
|
6388
6293
|
value: undefined,
|
|
6389
6294
|
};
|
|
6390
6295
|
this._element = document.createElement('div');
|
|
6391
|
-
this._element.
|
|
6392
|
-
this._element.style.width = '100%';
|
|
6296
|
+
this._element.className = 'dockview-react-part';
|
|
6393
6297
|
}
|
|
6394
6298
|
get element() {
|
|
6395
6299
|
return this._element;
|
|
@@ -6487,12 +6391,16 @@
|
|
|
6487
6391
|
frameworkTabComponents: props.tabComponents,
|
|
6488
6392
|
tabHeight: props.tabHeight,
|
|
6489
6393
|
debug: props.debug,
|
|
6490
|
-
enableExternalDragEvents: props.enableExternalDragEvents,
|
|
6491
6394
|
watermarkFrameworkComponent: props.watermarkComponent,
|
|
6492
6395
|
styles: props.hideBorders
|
|
6493
6396
|
? { separatorBorder: 'transparent' }
|
|
6494
6397
|
: undefined,
|
|
6495
6398
|
});
|
|
6399
|
+
const disposable = dockview.onDidDrop((event) => {
|
|
6400
|
+
if (props.onDidDrop) {
|
|
6401
|
+
props.onDidDrop(event);
|
|
6402
|
+
}
|
|
6403
|
+
});
|
|
6496
6404
|
(_a = domRef.current) === null || _a === void 0 ? void 0 : _a.appendChild(dockview.element);
|
|
6497
6405
|
dockview.deserializer = new ReactPanelDeserialzier(dockview);
|
|
6498
6406
|
const { clientWidth, clientHeight } = domRef.current;
|
|
@@ -6502,6 +6410,7 @@
|
|
|
6502
6410
|
}
|
|
6503
6411
|
dockviewRef.current = dockview;
|
|
6504
6412
|
return () => {
|
|
6413
|
+
disposable.dispose();
|
|
6505
6414
|
dockview.dispose();
|
|
6506
6415
|
};
|
|
6507
6416
|
}, []);
|
|
@@ -6513,6 +6422,14 @@
|
|
|
6513
6422
|
frameworkComponents: props.components,
|
|
6514
6423
|
});
|
|
6515
6424
|
}, [props.components]);
|
|
6425
|
+
React__namespace.useEffect(() => {
|
|
6426
|
+
if (!dockviewRef.current) {
|
|
6427
|
+
return;
|
|
6428
|
+
}
|
|
6429
|
+
dockviewRef.current.updateOptions({
|
|
6430
|
+
showDndOverlay: props.showDndOverlay,
|
|
6431
|
+
});
|
|
6432
|
+
}, [props.showDndOverlay]);
|
|
6516
6433
|
React__namespace.useEffect(() => {
|
|
6517
6434
|
if (!dockviewRef.current) {
|
|
6518
6435
|
return;
|
|
@@ -6601,9 +6518,9 @@
|
|
|
6601
6518
|
getComponent() {
|
|
6602
6519
|
var _a;
|
|
6603
6520
|
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
6604
|
-
params: ((_a = this.
|
|
6521
|
+
params: ((_a = this._params) === null || _a === void 0 ? void 0 : _a.params) || {},
|
|
6605
6522
|
api: this.api,
|
|
6606
|
-
containerApi: this.
|
|
6523
|
+
containerApi: this._params
|
|
6607
6524
|
.containerApi,
|
|
6608
6525
|
});
|
|
6609
6526
|
}
|
|
@@ -6676,9 +6593,9 @@
|
|
|
6676
6593
|
getComponent() {
|
|
6677
6594
|
var _a;
|
|
6678
6595
|
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
6679
|
-
params: ((_a = this.
|
|
6596
|
+
params: ((_a = this._params) === null || _a === void 0 ? void 0 : _a.params) || {},
|
|
6680
6597
|
api: this.api,
|
|
6681
|
-
containerApi: this.
|
|
6598
|
+
containerApi: this._params
|
|
6682
6599
|
.containerApi,
|
|
6683
6600
|
});
|
|
6684
6601
|
}
|
|
@@ -6869,7 +6786,6 @@
|
|
|
6869
6786
|
exports.BaseGrid = BaseGrid;
|
|
6870
6787
|
exports.CompositeDisposable = CompositeDisposable;
|
|
6871
6788
|
exports.ContentContainer = ContentContainer;
|
|
6872
|
-
exports.DATA_KEY = DATA_KEY;
|
|
6873
6789
|
exports.DockviewApi = DockviewApi;
|
|
6874
6790
|
exports.DockviewComponent = DockviewComponent;
|
|
6875
6791
|
exports.DockviewComponents = DockviewComponents;
|
|
@@ -6901,9 +6817,9 @@
|
|
|
6901
6817
|
exports.SplitviewPanel = SplitviewPanel;
|
|
6902
6818
|
exports.SplitviewReact = SplitviewReact;
|
|
6903
6819
|
exports.Tab = Tab$1;
|
|
6820
|
+
exports.TickDelayedEvent = TickDelayedEvent;
|
|
6904
6821
|
exports.addDisposableListener = addDisposableListener;
|
|
6905
6822
|
exports.addDisposableWindowListener = addDisposableWindowListener;
|
|
6906
|
-
exports.extractData = extractData;
|
|
6907
6823
|
exports.getDirectionOrientation = getDirectionOrientation;
|
|
6908
6824
|
exports.getGridLocation = getGridLocation;
|
|
6909
6825
|
exports.getLocationOrientation = getLocationOrientation;
|
|
@@ -6911,11 +6827,8 @@
|
|
|
6911
6827
|
exports.getPanelData = getPanelData;
|
|
6912
6828
|
exports.getRelativeLocation = getRelativeLocation;
|
|
6913
6829
|
exports.indexInParent = indexInParent;
|
|
6914
|
-
exports.isCustomDragEvent = isCustomDragEvent;
|
|
6915
6830
|
exports.isGridBranchNode = isGridBranchNode;
|
|
6916
|
-
exports.isPanelTransferEvent = isPanelTransferEvent;
|
|
6917
6831
|
exports.isReactElement = isReactElement;
|
|
6918
|
-
exports.isTabDragEvent = isTabDragEvent;
|
|
6919
6832
|
exports.orthogonal = orthogonal;
|
|
6920
6833
|
exports.toTarget = toTarget;
|
|
6921
6834
|
exports.usePortalsLifecycle = usePortalsLifecycle;
|