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
|
@@ -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
|
*/
|
|
@@ -57,7 +57,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
57
57
|
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) && this._last !== undefined) {
|
|
58
58
|
listener(this._last);
|
|
59
59
|
}
|
|
60
|
-
this._listeners.length === 0;
|
|
61
60
|
this._listeners.push(listener);
|
|
62
61
|
return {
|
|
63
62
|
dispose: () => {
|
|
@@ -73,9 +72,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
73
72
|
}
|
|
74
73
|
fire(e) {
|
|
75
74
|
this._last = e;
|
|
76
|
-
this._listeners
|
|
75
|
+
for (const listener of this._listeners) {
|
|
77
76
|
listener(e);
|
|
78
|
-
}
|
|
77
|
+
}
|
|
79
78
|
}
|
|
80
79
|
dispose() {
|
|
81
80
|
this._listeners = [];
|
|
@@ -97,6 +96,24 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
97
96
|
element.removeEventListener(type, listener);
|
|
98
97
|
},
|
|
99
98
|
};
|
|
99
|
+
}
|
|
100
|
+
class TickDelayedEvent {
|
|
101
|
+
constructor() {
|
|
102
|
+
this._onFired = new Emitter();
|
|
103
|
+
this.onEvent = this._onFired.event;
|
|
104
|
+
}
|
|
105
|
+
fire() {
|
|
106
|
+
if (this.timer) {
|
|
107
|
+
clearTimeout(this.timer);
|
|
108
|
+
}
|
|
109
|
+
this.timer = setTimeout(() => {
|
|
110
|
+
this._onFired.fire();
|
|
111
|
+
clearTimeout(this.timer);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
dispose() {
|
|
115
|
+
this._onFired.dispose();
|
|
116
|
+
}
|
|
100
117
|
}
|
|
101
118
|
|
|
102
119
|
exports.Disposable = void 0;
|
|
@@ -115,7 +132,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
115
132
|
return new CompositeDisposable(...args);
|
|
116
133
|
}
|
|
117
134
|
addDisposables(...args) {
|
|
118
|
-
args
|
|
135
|
+
args.forEach((arg) => this.disposables.push(arg));
|
|
119
136
|
}
|
|
120
137
|
dispose() {
|
|
121
138
|
this.disposables.forEach((arg) => arg.dispose());
|
|
@@ -134,20 +151,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
134
151
|
dispose() {
|
|
135
152
|
if (this._disposable) {
|
|
136
153
|
this._disposable.dispose();
|
|
154
|
+
this._disposable = exports.Disposable.NONE;
|
|
137
155
|
}
|
|
138
156
|
}
|
|
139
157
|
}
|
|
140
158
|
|
|
141
|
-
function tryParseJSON(text, reviver) {
|
|
142
|
-
try {
|
|
143
|
-
return JSON.parse(text, reviver);
|
|
144
|
-
}
|
|
145
|
-
catch (err) {
|
|
146
|
-
console.warn('failed to parse JSON');
|
|
147
|
-
return undefined;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
159
|
class TransferObject {
|
|
152
160
|
constructor() {
|
|
153
161
|
//
|
|
@@ -168,45 +176,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
168
176
|
this.paneId = paneId;
|
|
169
177
|
}
|
|
170
178
|
}
|
|
171
|
-
const DATA_KEY = 'splitview/transfer';
|
|
172
|
-
const isPanelTransferEvent = (event) => {
|
|
173
|
-
if (!event.dataTransfer) {
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
|
-
return event.dataTransfer.types.includes(DATA_KEY);
|
|
177
|
-
};
|
|
178
|
-
exports.DragType = void 0;
|
|
179
|
-
(function (DragType) {
|
|
180
|
-
DragType["DOCKVIEW_TAB"] = "dockview_tab";
|
|
181
|
-
DragType["EXTERNAL"] = "external_group_drag";
|
|
182
|
-
})(exports.DragType || (exports.DragType = {}));
|
|
183
|
-
/**
|
|
184
|
-
* Determine whether this data belong to that of an event that was started by
|
|
185
|
-
* dragging a tab component
|
|
186
|
-
*/
|
|
187
|
-
const isTabDragEvent = (data) => {
|
|
188
|
-
return data.type === exports.DragType.DOCKVIEW_TAB;
|
|
189
|
-
};
|
|
190
|
-
/**
|
|
191
|
-
* Determine whether this data belong to that of an event that was started by
|
|
192
|
-
* a custom drag-enable component
|
|
193
|
-
*/
|
|
194
|
-
const isCustomDragEvent = (data) => {
|
|
195
|
-
return data.type === exports.DragType.EXTERNAL;
|
|
196
|
-
};
|
|
197
|
-
const extractData = (event) => {
|
|
198
|
-
if (!event.dataTransfer) {
|
|
199
|
-
return null;
|
|
200
|
-
}
|
|
201
|
-
const data = tryParseJSON(event.dataTransfer.getData(DATA_KEY));
|
|
202
|
-
if (!data) {
|
|
203
|
-
console.warn(`[dragEvent] ${DATA_KEY} data is missing`);
|
|
204
|
-
}
|
|
205
|
-
if (typeof data.type !== 'string') {
|
|
206
|
-
console.warn(`[dragEvent] invalid type ${data.type}`);
|
|
207
|
-
}
|
|
208
|
-
return data;
|
|
209
|
-
};
|
|
210
179
|
/**
|
|
211
180
|
* A singleton to store transfer data during drag & drop operations that are only valid within the application.
|
|
212
181
|
*/
|
|
@@ -276,11 +245,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
276
245
|
get length() {
|
|
277
246
|
return this.component.length;
|
|
278
247
|
}
|
|
248
|
+
get orientation() {
|
|
249
|
+
return this.component.orientation;
|
|
250
|
+
}
|
|
279
251
|
get onDidLayoutChange() {
|
|
280
252
|
return this.component.onDidLayoutChange;
|
|
281
253
|
}
|
|
282
|
-
get
|
|
283
|
-
return this.component.
|
|
254
|
+
get onDidAddView() {
|
|
255
|
+
return this.component.onDidAddView;
|
|
256
|
+
}
|
|
257
|
+
get onDidRemoveView() {
|
|
258
|
+
return this.component.onDidRemoveView;
|
|
284
259
|
}
|
|
285
260
|
updateOptions(options) {
|
|
286
261
|
this.component.updateOptions(options);
|
|
@@ -326,21 +301,38 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
326
301
|
constructor(component) {
|
|
327
302
|
this.component = component;
|
|
328
303
|
}
|
|
329
|
-
get width() {
|
|
330
|
-
return this.component.width;
|
|
331
|
-
}
|
|
332
|
-
get height() {
|
|
333
|
-
return this.component.height;
|
|
334
|
-
}
|
|
335
304
|
get minimumSize() {
|
|
336
305
|
return this.component.minimumSize;
|
|
337
306
|
}
|
|
338
307
|
get maximumSize() {
|
|
339
308
|
return this.component.maximumSize;
|
|
340
309
|
}
|
|
310
|
+
get height() {
|
|
311
|
+
return this.component.height;
|
|
312
|
+
}
|
|
313
|
+
get width() {
|
|
314
|
+
return this.component.width;
|
|
315
|
+
}
|
|
341
316
|
get onDidLayoutChange() {
|
|
342
317
|
return this.component.onDidLayoutChange;
|
|
343
318
|
}
|
|
319
|
+
get onDidAddView() {
|
|
320
|
+
return this.component.onDidAddView;
|
|
321
|
+
}
|
|
322
|
+
get onDidRemoveView() {
|
|
323
|
+
return this.component.onDidRemoveView;
|
|
324
|
+
}
|
|
325
|
+
get onDidDrop() {
|
|
326
|
+
const emitter = new Emitter();
|
|
327
|
+
const disposable = this.component.onDidDrop((e) => {
|
|
328
|
+
emitter.fire(Object.assign(Object.assign({}, e), { api: this }));
|
|
329
|
+
});
|
|
330
|
+
emitter.dispose = () => {
|
|
331
|
+
disposable.dispose();
|
|
332
|
+
emitter.dispose();
|
|
333
|
+
};
|
|
334
|
+
return emitter.event;
|
|
335
|
+
}
|
|
344
336
|
getPanels() {
|
|
345
337
|
return this.component.getPanels();
|
|
346
338
|
}
|
|
@@ -376,12 +368,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
376
368
|
constructor(component) {
|
|
377
369
|
this.component = component;
|
|
378
370
|
}
|
|
379
|
-
get width() {
|
|
380
|
-
return this.component.width;
|
|
381
|
-
}
|
|
382
|
-
get height() {
|
|
383
|
-
return this.component.height;
|
|
384
|
-
}
|
|
385
371
|
get minimumHeight() {
|
|
386
372
|
return this.component.minimumHeight;
|
|
387
373
|
}
|
|
@@ -394,12 +380,30 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
394
380
|
get maximumWidth() {
|
|
395
381
|
return this.component.maximumWidth;
|
|
396
382
|
}
|
|
383
|
+
get width() {
|
|
384
|
+
return this.component.width;
|
|
385
|
+
}
|
|
386
|
+
get height() {
|
|
387
|
+
return this.component.height;
|
|
388
|
+
}
|
|
397
389
|
get onGridEvent() {
|
|
398
390
|
return this.component.onGridEvent;
|
|
399
391
|
}
|
|
400
392
|
get onDidLayoutChange() {
|
|
401
393
|
return this.component.onDidLayoutChange;
|
|
402
394
|
}
|
|
395
|
+
get onDidAddGroup() {
|
|
396
|
+
return this.component.onDidAddGroup;
|
|
397
|
+
}
|
|
398
|
+
get onDidRemoveGroup() {
|
|
399
|
+
return this.component.onDidRemoveGroup;
|
|
400
|
+
}
|
|
401
|
+
get onDidActiveGroupChange() {
|
|
402
|
+
return this.component.onDidActiveGroupChange;
|
|
403
|
+
}
|
|
404
|
+
get onDidLayoutFromJSON() {
|
|
405
|
+
return this.component.onDidLayoutFromJSON;
|
|
406
|
+
}
|
|
403
407
|
get panels() {
|
|
404
408
|
return this.component.groups;
|
|
405
409
|
}
|
|
@@ -477,6 +481,27 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
477
481
|
get onGridEvent() {
|
|
478
482
|
return this.component.onGridEvent;
|
|
479
483
|
}
|
|
484
|
+
get onDidActiveGroupChange() {
|
|
485
|
+
return this.component.onDidActiveGroupChange;
|
|
486
|
+
}
|
|
487
|
+
get onDidAddGroup() {
|
|
488
|
+
return this.component.onDidAddGroup;
|
|
489
|
+
}
|
|
490
|
+
get onDidRemoveGroup() {
|
|
491
|
+
return this.component.onDidRemoveGroup;
|
|
492
|
+
}
|
|
493
|
+
get onDidActivePanelChange() {
|
|
494
|
+
return this.component.onDidActivePanelChange;
|
|
495
|
+
}
|
|
496
|
+
get onDidAddPanel() {
|
|
497
|
+
return this.component.onDidAddPanel;
|
|
498
|
+
}
|
|
499
|
+
get onDidRemovePanel() {
|
|
500
|
+
return this.component.onDidRemovePanel;
|
|
501
|
+
}
|
|
502
|
+
get onDidLayoutfromJSON() {
|
|
503
|
+
return this.component.onDidLayoutfromJSON;
|
|
504
|
+
}
|
|
480
505
|
get onDidLayoutChange() {
|
|
481
506
|
return this.component.onDidLayoutChange;
|
|
482
507
|
}
|
|
@@ -504,18 +529,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
504
529
|
getPanel(id) {
|
|
505
530
|
return this.component.getGroupPanel(id);
|
|
506
531
|
}
|
|
507
|
-
setActivePanel(panel) {
|
|
508
|
-
this.component.setActivePanel(panel);
|
|
509
|
-
}
|
|
510
532
|
layout(width, height, force = false) {
|
|
511
533
|
this.component.layout(width, height, force);
|
|
512
534
|
}
|
|
513
535
|
addPanel(options) {
|
|
514
536
|
return this.component.addPanel(options);
|
|
515
537
|
}
|
|
516
|
-
removePanel(panel) {
|
|
517
|
-
this.component.removePanel(panel);
|
|
518
|
-
}
|
|
519
538
|
addEmptyGroup(options) {
|
|
520
539
|
this.component.addEmptyGroup(options);
|
|
521
540
|
}
|
|
@@ -863,7 +882,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
863
882
|
this._onDidAddView = new Emitter();
|
|
864
883
|
this.onDidAddView = this._onDidAddView.event;
|
|
865
884
|
this._onDidRemoveView = new Emitter();
|
|
866
|
-
this.onDidRemoveView = this.
|
|
885
|
+
this.onDidRemoveView = this._onDidRemoveView.event;
|
|
867
886
|
this._startSnappingEnabled = true;
|
|
868
887
|
this._endSnappingEnabled = true;
|
|
869
888
|
this.resize = (index, delta, sizes = this.views.map((x) => x.size), lowPriorityIndexes, highPriorityIndexes, overloadMinDelta = Number.NEGATIVE_INFINITY, overloadMaxDelta = Number.POSITIVE_INFINITY, snapBefore, snapAfter) => {
|
|
@@ -1505,9 +1524,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1505
1524
|
var _a;
|
|
1506
1525
|
super();
|
|
1507
1526
|
this.paneItems = [];
|
|
1527
|
+
this.skipAnimation = false;
|
|
1508
1528
|
this._onDidChange = new Emitter();
|
|
1509
1529
|
this.onDidChange = this._onDidChange.event;
|
|
1510
|
-
this.skipAnimation = false;
|
|
1511
1530
|
this._orientation = (_a = options.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.VERTICAL;
|
|
1512
1531
|
this.element = document.createElement('div');
|
|
1513
1532
|
this.element.className = 'pane-container';
|
|
@@ -1535,7 +1554,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1535
1554
|
this.paneItems.push(paneItem);
|
|
1536
1555
|
pane.orthogonalSize = this.splitview.orthogonalSize;
|
|
1537
1556
|
});
|
|
1538
|
-
this.addDisposables(this.splitview.onDidSashEnd(() => {
|
|
1557
|
+
this.addDisposables(this._onDidChange, this.splitview.onDidSashEnd(() => {
|
|
1539
1558
|
this._onDidChange.fire(undefined);
|
|
1540
1559
|
}), this.splitview.onDidAddView(() => {
|
|
1541
1560
|
this._onDidChange.fire();
|
|
@@ -1607,9 +1626,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1607
1626
|
}
|
|
1608
1627
|
}
|
|
1609
1628
|
layout(size, orthogonalSize) {
|
|
1610
|
-
// for (const paneItem of this.paneItems) {
|
|
1611
|
-
// paneItem.pane.orthogonalSize = orthogonalSize;
|
|
1612
|
-
// }
|
|
1613
1629
|
this.splitview.layout(size, orthogonalSize);
|
|
1614
1630
|
}
|
|
1615
1631
|
setupAnimation() {
|
|
@@ -1699,7 +1715,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1699
1715
|
this.options = options;
|
|
1700
1716
|
this._onDrop = new Emitter();
|
|
1701
1717
|
this.onDrop = this._onDrop.event;
|
|
1702
|
-
this.addDisposables(new DragAndDropObserver(this.element, {
|
|
1718
|
+
this.addDisposables(this._onDrop, new DragAndDropObserver(this.element, {
|
|
1703
1719
|
onDragEnter: (e) => undefined,
|
|
1704
1720
|
onDragOver: (e) => {
|
|
1705
1721
|
if (isBooleanValue(this.options.canDisplayOverlay)) {
|
|
@@ -1735,51 +1751,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1735
1751
|
const y = e.offsetY;
|
|
1736
1752
|
const xp = (100 * x) / width;
|
|
1737
1753
|
const yp = (100 * y) / height;
|
|
1738
|
-
|
|
1739
|
-
let isLeft = false;
|
|
1740
|
-
let isTop = false;
|
|
1741
|
-
let isBottom = false;
|
|
1742
|
-
switch (this.options.validOverlays) {
|
|
1743
|
-
case 'all':
|
|
1744
|
-
isRight = xp > 80;
|
|
1745
|
-
isLeft = xp < 20;
|
|
1746
|
-
isTop = !isRight && !isLeft && yp < 20;
|
|
1747
|
-
isBottom = !isRight && !isLeft && yp > 80;
|
|
1748
|
-
break;
|
|
1749
|
-
case 'vertical':
|
|
1750
|
-
isTop = yp < 50;
|
|
1751
|
-
isBottom = yp >= 50;
|
|
1752
|
-
break;
|
|
1753
|
-
case 'horizontal':
|
|
1754
|
-
isLeft = xp < 50;
|
|
1755
|
-
isRight = xp >= 50;
|
|
1756
|
-
break;
|
|
1757
|
-
}
|
|
1754
|
+
const quadrant = this.calculateQuadrant(this.options.validOverlays, xp, yp);
|
|
1758
1755
|
const isSmallX = width < 100;
|
|
1759
1756
|
const isSmallY = height < 100;
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
toggleClass(this.overlay, 'top', !isSmallY && isTop);
|
|
1763
|
-
toggleClass(this.overlay, 'bottom', !isSmallY && isBottom);
|
|
1764
|
-
toggleClass(this.overlay, 'small-right', isSmallX && isRight);
|
|
1765
|
-
toggleClass(this.overlay, 'small-left', isSmallX && isLeft);
|
|
1766
|
-
toggleClass(this.overlay, 'small-top', isSmallY && isTop);
|
|
1767
|
-
toggleClass(this.overlay, 'small-bottom', isSmallY && isBottom);
|
|
1768
|
-
if (isRight) {
|
|
1769
|
-
this._state = exports.Position.Right;
|
|
1770
|
-
}
|
|
1771
|
-
else if (isLeft) {
|
|
1772
|
-
this._state = exports.Position.Left;
|
|
1773
|
-
}
|
|
1774
|
-
else if (isTop) {
|
|
1775
|
-
this._state = exports.Position.Top;
|
|
1776
|
-
}
|
|
1777
|
-
else if (isBottom) {
|
|
1778
|
-
this._state = exports.Position.Bottom;
|
|
1779
|
-
}
|
|
1780
|
-
else {
|
|
1781
|
-
this._state = exports.Position.Center;
|
|
1782
|
-
}
|
|
1757
|
+
this.toggleClasses(quadrant, isSmallX, isSmallY);
|
|
1758
|
+
this.setState(quadrant);
|
|
1783
1759
|
},
|
|
1784
1760
|
onDragLeave: (e) => {
|
|
1785
1761
|
this.removeDropTarget();
|
|
@@ -1793,7 +1769,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1793
1769
|
const state = this._state;
|
|
1794
1770
|
this.removeDropTarget();
|
|
1795
1771
|
if (state) {
|
|
1796
|
-
this._onDrop.fire({ position: state,
|
|
1772
|
+
this._onDrop.fire({ position: state, nativeEvent: e });
|
|
1797
1773
|
}
|
|
1798
1774
|
},
|
|
1799
1775
|
}));
|
|
@@ -1808,9 +1784,73 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1808
1784
|
this.options.canDisplayOverlay = value;
|
|
1809
1785
|
}
|
|
1810
1786
|
dispose() {
|
|
1811
|
-
this._onDrop.dispose();
|
|
1812
1787
|
this.removeDropTarget();
|
|
1813
1788
|
}
|
|
1789
|
+
toggleClasses(quadrant, isSmallX, isSmallY) {
|
|
1790
|
+
if (!this.overlay) {
|
|
1791
|
+
return;
|
|
1792
|
+
}
|
|
1793
|
+
const isLeft = quadrant === 'left';
|
|
1794
|
+
const isRight = quadrant === 'right';
|
|
1795
|
+
const isTop = quadrant === 'top';
|
|
1796
|
+
const isBottom = quadrant === 'bottom';
|
|
1797
|
+
toggleClass(this.overlay, 'right', !isSmallX && isRight);
|
|
1798
|
+
toggleClass(this.overlay, 'left', !isSmallX && isLeft);
|
|
1799
|
+
toggleClass(this.overlay, 'top', !isSmallY && isTop);
|
|
1800
|
+
toggleClass(this.overlay, 'bottom', !isSmallY && isBottom);
|
|
1801
|
+
toggleClass(this.overlay, 'small-right', isSmallX && isRight);
|
|
1802
|
+
toggleClass(this.overlay, 'small-left', isSmallX && isLeft);
|
|
1803
|
+
toggleClass(this.overlay, 'small-top', isSmallY && isTop);
|
|
1804
|
+
toggleClass(this.overlay, 'small-bottom', isSmallY && isBottom);
|
|
1805
|
+
}
|
|
1806
|
+
setState(quadrant) {
|
|
1807
|
+
switch (quadrant) {
|
|
1808
|
+
case 'top':
|
|
1809
|
+
this._state = exports.Position.Top;
|
|
1810
|
+
break;
|
|
1811
|
+
case 'left':
|
|
1812
|
+
this._state = exports.Position.Left;
|
|
1813
|
+
break;
|
|
1814
|
+
case 'bottom':
|
|
1815
|
+
this._state = exports.Position.Bottom;
|
|
1816
|
+
break;
|
|
1817
|
+
case 'right':
|
|
1818
|
+
this._state = exports.Position.Right;
|
|
1819
|
+
break;
|
|
1820
|
+
default:
|
|
1821
|
+
this._state = exports.Position.Center;
|
|
1822
|
+
break;
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
calculateQuadrant(overlayType, xp, yp) {
|
|
1826
|
+
switch (overlayType) {
|
|
1827
|
+
case 'all':
|
|
1828
|
+
if (xp < 20) {
|
|
1829
|
+
return 'left';
|
|
1830
|
+
}
|
|
1831
|
+
if (xp > 80) {
|
|
1832
|
+
return 'right';
|
|
1833
|
+
}
|
|
1834
|
+
if (yp < 20) {
|
|
1835
|
+
return 'top';
|
|
1836
|
+
}
|
|
1837
|
+
if (yp > 80) {
|
|
1838
|
+
return 'bottom';
|
|
1839
|
+
}
|
|
1840
|
+
break;
|
|
1841
|
+
case 'vertical':
|
|
1842
|
+
if (yp < 50) {
|
|
1843
|
+
return 'top';
|
|
1844
|
+
}
|
|
1845
|
+
return 'bottom';
|
|
1846
|
+
case 'horizontal':
|
|
1847
|
+
if (xp < 50) {
|
|
1848
|
+
return 'left';
|
|
1849
|
+
}
|
|
1850
|
+
return 'right';
|
|
1851
|
+
}
|
|
1852
|
+
return null;
|
|
1853
|
+
}
|
|
1814
1854
|
removeDropTarget() {
|
|
1815
1855
|
if (this.target) {
|
|
1816
1856
|
this._state = undefined;
|
|
@@ -1913,6 +1953,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1913
1953
|
this.view.layout(this.width, this.height);
|
|
1914
1954
|
}
|
|
1915
1955
|
dispose() {
|
|
1956
|
+
this._onDidChange.dispose();
|
|
1916
1957
|
this._disposable.dispose();
|
|
1917
1958
|
}
|
|
1918
1959
|
}
|
|
@@ -1964,7 +2005,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1964
2005
|
proportionalLayout,
|
|
1965
2006
|
});
|
|
1966
2007
|
}
|
|
1967
|
-
this.addDisposables(this.splitview.onDidSashEnd(() => {
|
|
2008
|
+
this.addDisposables(this._onDidChange, this.splitview.onDidSashEnd(() => {
|
|
1968
2009
|
this._onDidChange.fire(undefined);
|
|
1969
2010
|
}));
|
|
1970
2011
|
this.setupChildrenEvents();
|
|
@@ -2136,6 +2177,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2136
2177
|
* Accreditation: This file is largly based upon the MIT licenced VSCode sourcecode found at:
|
|
2137
2178
|
* https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid
|
|
2138
2179
|
*--------------------------------------------------------------------------------------------*/
|
|
2180
|
+
function findLeaf(candiateNode, last) {
|
|
2181
|
+
if (candiateNode instanceof LeafNode) {
|
|
2182
|
+
return candiateNode;
|
|
2183
|
+
}
|
|
2184
|
+
if (candiateNode instanceof BranchNode) {
|
|
2185
|
+
return findLeaf(candiateNode.children[last ? candiateNode.children.length - 1 : 0], last);
|
|
2186
|
+
}
|
|
2187
|
+
throw new Error('invalid node');
|
|
2188
|
+
}
|
|
2139
2189
|
function flipNode(node, size, orthogonalSize) {
|
|
2140
2190
|
if (node instanceof BranchNode) {
|
|
2141
2191
|
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize);
|
|
@@ -2274,13 +2324,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2274
2324
|
}
|
|
2275
2325
|
deserialize(json, deserializer) {
|
|
2276
2326
|
const orientation = json.orientation;
|
|
2277
|
-
const height = json.height;
|
|
2327
|
+
const height = orientation === exports.Orientation.VERTICAL ? json.height : json.width;
|
|
2278
2328
|
this._deserialize(json.root, orientation, deserializer, height);
|
|
2279
2329
|
}
|
|
2280
2330
|
_deserialize(root, orientation, deserializer, orthogonalSize) {
|
|
2281
|
-
this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize);
|
|
2331
|
+
this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize, true);
|
|
2282
2332
|
}
|
|
2283
|
-
_deserializeNode(node, orientation, deserializer, orthogonalSize) {
|
|
2333
|
+
_deserializeNode(node, orientation, deserializer, orthogonalSize, isRoot = false) {
|
|
2284
2334
|
let result;
|
|
2285
2335
|
if (node.type === 'branch') {
|
|
2286
2336
|
const serializedChildren = node.data;
|
|
@@ -2290,7 +2340,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2290
2340
|
visible: serializedChild.visible,
|
|
2291
2341
|
};
|
|
2292
2342
|
});
|
|
2293
|
-
|
|
2343
|
+
// HORIZONTAL => height=orthogonalsize width=size
|
|
2344
|
+
// VERTICAL => height=size width=orthogonalsize
|
|
2345
|
+
result = new BranchNode(orientation, this.proportionalLayout, this.styles, isRoot ? orthogonalSize : node.size, isRoot ? node.size : orthogonalSize, children);
|
|
2294
2346
|
}
|
|
2295
2347
|
else {
|
|
2296
2348
|
result = new LeafNode(deserializer.fromJSON(node), orientation, orthogonalSize, node.size);
|
|
@@ -2351,15 +2403,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2351
2403
|
if (!(node instanceof LeafNode)) {
|
|
2352
2404
|
throw new Error('invalid location');
|
|
2353
2405
|
}
|
|
2354
|
-
const findLeaf = (candiateNode, last) => {
|
|
2355
|
-
if (candiateNode instanceof LeafNode) {
|
|
2356
|
-
return candiateNode;
|
|
2357
|
-
}
|
|
2358
|
-
if (candiateNode instanceof BranchNode) {
|
|
2359
|
-
return findLeaf(candiateNode.children[last ? candiateNode.children.length - 1 : 0], last);
|
|
2360
|
-
}
|
|
2361
|
-
throw new Error('invalid node');
|
|
2362
|
-
};
|
|
2363
2406
|
for (let i = path.length - 1; i > -1; i--) {
|
|
2364
2407
|
const n = path[i];
|
|
2365
2408
|
const l = location[i] || 0;
|
|
@@ -2456,15 +2499,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2456
2499
|
}
|
|
2457
2500
|
parent.removeChild(index, sizing);
|
|
2458
2501
|
if (parent.children.length === 0) {
|
|
2459
|
-
// throw new Error('Invalid grid state');
|
|
2460
2502
|
return node.view;
|
|
2461
2503
|
}
|
|
2462
2504
|
if (parent.children.length > 1) {
|
|
2463
2505
|
return node.view;
|
|
2464
2506
|
}
|
|
2507
|
+
const sibling = parent.children[0];
|
|
2465
2508
|
if (pathToParent.length === 0) {
|
|
2466
2509
|
// parent is root
|
|
2467
|
-
const sibling = parent.children[0];
|
|
2468
2510
|
if (sibling instanceof LeafNode) {
|
|
2469
2511
|
return node.view;
|
|
2470
2512
|
}
|
|
@@ -2475,7 +2517,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2475
2517
|
}
|
|
2476
2518
|
const [grandParent, ..._] = [...pathToParent].reverse();
|
|
2477
2519
|
const [parentIndex, ...__] = [...rest].reverse();
|
|
2478
|
-
const sibling = parent.children[0];
|
|
2479
2520
|
const isSiblingVisible = parent.isChildVisible(0);
|
|
2480
2521
|
parent.removeChild(0, sizing);
|
|
2481
2522
|
const sizes = grandParent.children.map((size, i) => grandParent.getChildSize(i));
|
|
@@ -2522,31 +2563,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2522
2563
|
}
|
|
2523
2564
|
}
|
|
2524
2565
|
|
|
2525
|
-
/*! *****************************************************************************
|
|
2526
|
-
Copyright (c) Microsoft Corporation.
|
|
2527
|
-
|
|
2528
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
2529
|
-
purpose with or without fee is hereby granted.
|
|
2530
|
-
|
|
2531
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2532
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2533
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2534
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2535
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2536
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2537
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
2538
|
-
***************************************************************************** */
|
|
2539
|
-
|
|
2540
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
2541
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2542
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2543
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2544
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2545
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2546
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2547
|
-
});
|
|
2548
|
-
}
|
|
2549
|
-
|
|
2550
2566
|
class ContentContainer extends CompositeDisposable {
|
|
2551
2567
|
constructor() {
|
|
2552
2568
|
super();
|
|
@@ -2558,6 +2574,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2558
2574
|
this._element = document.createElement('div');
|
|
2559
2575
|
this._element.className = 'content-container';
|
|
2560
2576
|
this._element.tabIndex = -1;
|
|
2577
|
+
this.addDisposables(this._onDidFocus, this._onDidBlur);
|
|
2561
2578
|
// for hosted containers
|
|
2562
2579
|
// 1) register a drop target on the host
|
|
2563
2580
|
// 2) register window dragStart events to disable pointer events
|
|
@@ -2624,6 +2641,41 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2624
2641
|
DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
|
|
2625
2642
|
})(DockviewDropTargets || (DockviewDropTargets = {}));
|
|
2626
2643
|
|
|
2644
|
+
class DragHandler extends CompositeDisposable {
|
|
2645
|
+
constructor(el) {
|
|
2646
|
+
super();
|
|
2647
|
+
this.el = el;
|
|
2648
|
+
this.disposable = new MutableDisposable();
|
|
2649
|
+
this._onDragStart = new Emitter();
|
|
2650
|
+
this.onDragStart = this._onDragStart.event;
|
|
2651
|
+
this.iframes = [];
|
|
2652
|
+
this.configure();
|
|
2653
|
+
}
|
|
2654
|
+
configure() {
|
|
2655
|
+
this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
|
|
2656
|
+
this.iframes = [
|
|
2657
|
+
...getElementsByTagName('iframe'),
|
|
2658
|
+
...getElementsByTagName('webview'),
|
|
2659
|
+
];
|
|
2660
|
+
for (const iframe of this.iframes) {
|
|
2661
|
+
iframe.style.pointerEvents = 'none';
|
|
2662
|
+
}
|
|
2663
|
+
this.el.classList.add('dragged');
|
|
2664
|
+
setTimeout(() => this.el.classList.remove('dragged'), 0);
|
|
2665
|
+
this.disposable.value = this.getData();
|
|
2666
|
+
if (event.dataTransfer) {
|
|
2667
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
2668
|
+
}
|
|
2669
|
+
}), addDisposableListener(this.el, 'dragend', (ev) => {
|
|
2670
|
+
for (const iframe of this.iframes) {
|
|
2671
|
+
iframe.style.pointerEvents = 'auto';
|
|
2672
|
+
}
|
|
2673
|
+
this.iframes = [];
|
|
2674
|
+
this.disposable.dispose();
|
|
2675
|
+
}));
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2627
2679
|
exports.MouseEventKind = void 0;
|
|
2628
2680
|
(function (MouseEventKind) {
|
|
2629
2681
|
MouseEventKind["CLICK"] = "CLICK";
|
|
@@ -2633,42 +2685,34 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2633
2685
|
constructor(panelId, accessor, group) {
|
|
2634
2686
|
super();
|
|
2635
2687
|
this.panelId = panelId;
|
|
2636
|
-
this.accessor = accessor;
|
|
2637
2688
|
this.group = group;
|
|
2638
2689
|
this._onChanged = new Emitter();
|
|
2639
2690
|
this.onChanged = this._onChanged.event;
|
|
2640
2691
|
this._onDropped = new Emitter();
|
|
2641
2692
|
this.onDrop = this._onDropped.event;
|
|
2642
|
-
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
2643
|
-
this.iframes = [];
|
|
2644
2693
|
this.addDisposables(this._onChanged, this._onDropped);
|
|
2645
2694
|
this._element = document.createElement('div');
|
|
2646
2695
|
this._element.className = 'tab';
|
|
2647
2696
|
this._element.tabIndex = 0;
|
|
2648
2697
|
this._element.draggable = true;
|
|
2649
|
-
this.addDisposables(
|
|
2650
|
-
|
|
2651
|
-
...
|
|
2652
|
-
|
|
2653
|
-
];
|
|
2654
|
-
for (const iframe of this.iframes) {
|
|
2655
|
-
iframe.style.pointerEvents = 'none';
|
|
2698
|
+
this.addDisposables(new (class Handler extends DragHandler {
|
|
2699
|
+
constructor() {
|
|
2700
|
+
super(...arguments);
|
|
2701
|
+
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
2656
2702
|
}
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2703
|
+
getData() {
|
|
2704
|
+
this.panelTransfer.setData([new PanelTransfer(accessor.id, group.id, panelId)], PanelTransfer.prototype);
|
|
2705
|
+
return {
|
|
2706
|
+
dispose: () => {
|
|
2707
|
+
this.panelTransfer.clearData(PanelTransfer.prototype);
|
|
2708
|
+
},
|
|
2709
|
+
};
|
|
2664
2710
|
}
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
iframe.style.pointerEvents = 'auto';
|
|
2711
|
+
dispose() {
|
|
2712
|
+
//
|
|
2668
2713
|
}
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
}), addDisposableListener(this._element, 'mousedown', (event) => {
|
|
2714
|
+
})(this._element));
|
|
2715
|
+
this.addDisposables(addDisposableListener(this._element, 'mousedown', (event) => {
|
|
2672
2716
|
if (event.defaultPrevented) {
|
|
2673
2717
|
return;
|
|
2674
2718
|
}
|
|
@@ -2757,7 +2801,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2757
2801
|
});
|
|
2758
2802
|
this.addDisposables(this.voidDropTarget.onDrop((event) => {
|
|
2759
2803
|
this._onDrop.fire({
|
|
2760
|
-
event: event.
|
|
2804
|
+
event: event.nativeEvent,
|
|
2761
2805
|
index: this.tabs.length,
|
|
2762
2806
|
});
|
|
2763
2807
|
}), this.voidDropTarget, addDisposableListener(this.tabContainer, 'mousedown', (event) => {
|
|
@@ -2870,16 +2914,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2870
2914
|
if (!isLeftClick || event.event.defaultPrevented) {
|
|
2871
2915
|
return;
|
|
2872
2916
|
}
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
});
|
|
2878
|
-
break;
|
|
2917
|
+
if (event.kind === exports.MouseEventKind.CLICK) {
|
|
2918
|
+
this.group.model.openPanel(panel, {
|
|
2919
|
+
skipFocus: alreadyFocused,
|
|
2920
|
+
});
|
|
2879
2921
|
}
|
|
2880
2922
|
}), tabToAdd.onDrop((event) => {
|
|
2881
2923
|
this._onDrop.fire({
|
|
2882
|
-
event: event.
|
|
2924
|
+
event: event.nativeEvent,
|
|
2883
2925
|
index: this.tabs.findIndex((x) => x.value === tabToAdd),
|
|
2884
2926
|
});
|
|
2885
2927
|
}));
|
|
@@ -2904,7 +2946,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2904
2946
|
GroupChangeKind2["ADD_PANEL"] = "ADD_PANEL";
|
|
2905
2947
|
GroupChangeKind2["REMOVE_PANEL"] = "REMOVE_PANEL";
|
|
2906
2948
|
GroupChangeKind2["PANEL_ACTIVE"] = "PANEL_ACTIVE";
|
|
2907
|
-
GroupChangeKind2["GROUP_ACTIVE"] = "GROUP_ACTIVE";
|
|
2908
2949
|
})(exports.GroupChangeKind2 || (exports.GroupChangeKind2 = {}));
|
|
2909
2950
|
class Groupview extends CompositeDisposable {
|
|
2910
2951
|
constructor(container, accessor, id, options, parent) {
|
|
@@ -2925,15 +2966,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2925
2966
|
this.onMove = this._onMove.event;
|
|
2926
2967
|
this._onDidGroupChange = new Emitter();
|
|
2927
2968
|
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
2928
|
-
this.
|
|
2929
|
-
|
|
2930
|
-
return false;
|
|
2931
|
-
}
|
|
2932
|
-
this.doClose(panel);
|
|
2933
|
-
return true;
|
|
2934
|
-
});
|
|
2969
|
+
this._onDidDrop = new Emitter();
|
|
2970
|
+
this.onDidDrop = this._onDidDrop.event;
|
|
2935
2971
|
this.container.classList.add('groupview');
|
|
2936
|
-
this.addDisposables(this._onMove, this._onDidGroupChange);
|
|
2972
|
+
this.addDisposables(this._onMove, this._onDidGroupChange, this._onDidChange, this._onDidDrop);
|
|
2937
2973
|
this.tabsContainer = new TabsContainer(this.accessor, this.parent, {
|
|
2938
2974
|
tabHeight: options.tabHeight,
|
|
2939
2975
|
});
|
|
@@ -2955,9 +2991,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2955
2991
|
}), this.contentContainer.onDidFocus(() => {
|
|
2956
2992
|
this.accessor.doSetGroupActive(this.parent, true);
|
|
2957
2993
|
}), this.contentContainer.onDidBlur(() => {
|
|
2958
|
-
//
|
|
2994
|
+
// noop
|
|
2959
2995
|
}), this.dropTarget.onDrop((event) => {
|
|
2960
|
-
this.handleDropEvent(event.
|
|
2996
|
+
this.handleDropEvent(event.nativeEvent, event.position);
|
|
2961
2997
|
}));
|
|
2962
2998
|
}
|
|
2963
2999
|
get element() {
|
|
@@ -3090,6 +3126,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3090
3126
|
options.index > this.panels.length) {
|
|
3091
3127
|
options.index = this.panels.length;
|
|
3092
3128
|
}
|
|
3129
|
+
// ensure the group is updated before we fire any events
|
|
3130
|
+
panel.updateParentGroup(this.parent, true);
|
|
3093
3131
|
if (this._activePanel === panel) {
|
|
3094
3132
|
this.accessor.doSetGroupActive(this.parent);
|
|
3095
3133
|
return;
|
|
@@ -3110,43 +3148,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3110
3148
|
return this._removePanel(panelToRemove);
|
|
3111
3149
|
}
|
|
3112
3150
|
closeAllPanels() {
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
const
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
if (this._activePanel && index > -1) {
|
|
3119
|
-
if (this.panels.indexOf(this._activePanel) < 0) {
|
|
3120
|
-
console.warn('active panel not tracked');
|
|
3121
|
-
}
|
|
3122
|
-
const canClose = !((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.close) || (yield this._activePanel.close());
|
|
3123
|
-
if (!canClose) {
|
|
3124
|
-
return false;
|
|
3125
|
-
}
|
|
3126
|
-
}
|
|
3127
|
-
for (let i = 0; i < this.panels.length; i++) {
|
|
3128
|
-
if (i === index) {
|
|
3129
|
-
continue;
|
|
3130
|
-
}
|
|
3131
|
-
const panel = this.panels[i];
|
|
3132
|
-
this.openPanel(panel);
|
|
3133
|
-
if (panel.close) {
|
|
3134
|
-
const canClose = yield panel.close();
|
|
3135
|
-
if (!canClose) {
|
|
3136
|
-
return false;
|
|
3137
|
-
}
|
|
3138
|
-
}
|
|
3139
|
-
}
|
|
3140
|
-
if (this.panels.length > 0) {
|
|
3141
|
-
// take a copy since we will be edting the array as we iterate through
|
|
3142
|
-
const arrPanelCpy = [...this.panels];
|
|
3143
|
-
yield Promise.all(arrPanelCpy.map((p) => this.doClose(p)));
|
|
3151
|
+
if (this.panels.length > 0) {
|
|
3152
|
+
// take a copy since we will be edting the array as we iterate through
|
|
3153
|
+
const arrPanelCpy = [...this.panels];
|
|
3154
|
+
for (const panel of arrPanelCpy) {
|
|
3155
|
+
this.doClose(panel);
|
|
3144
3156
|
}
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3157
|
+
}
|
|
3158
|
+
else {
|
|
3159
|
+
this.accessor.removeGroup(this.parent);
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
closePanel(panel) {
|
|
3163
|
+
this.doClose(panel);
|
|
3150
3164
|
}
|
|
3151
3165
|
doClose(panel) {
|
|
3152
3166
|
this.accessor.removePanel(panel);
|
|
@@ -3289,8 +3303,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3289
3303
|
this.tabsContainer.show();
|
|
3290
3304
|
}
|
|
3291
3305
|
}
|
|
3292
|
-
canDisplayOverlay(
|
|
3306
|
+
canDisplayOverlay(event, target) {
|
|
3293
3307
|
// custom overlay handler
|
|
3308
|
+
if (this.accessor.options.showDndOverlay) {
|
|
3309
|
+
return this.accessor.options.showDndOverlay(event, target);
|
|
3310
|
+
}
|
|
3294
3311
|
return false;
|
|
3295
3312
|
}
|
|
3296
3313
|
handleDropEvent(event, position, index) {
|
|
@@ -3315,6 +3332,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3315
3332
|
index,
|
|
3316
3333
|
});
|
|
3317
3334
|
}
|
|
3335
|
+
else {
|
|
3336
|
+
this._onDidDrop.fire({ nativeEvent: event, position, index });
|
|
3337
|
+
}
|
|
3318
3338
|
}
|
|
3319
3339
|
dispose() {
|
|
3320
3340
|
for (const panel of this.panels) {
|
|
@@ -3367,19 +3387,21 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3367
3387
|
this.onGridEvent = this._onGridEvent.event;
|
|
3368
3388
|
this._onDidLayoutChange = new Emitter();
|
|
3369
3389
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
3390
|
+
this._onDidRemoveGroup = new Emitter();
|
|
3391
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
3392
|
+
this._onDidAddGroup = new Emitter();
|
|
3393
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
3394
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
3395
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
3370
3396
|
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
3371
3397
|
this.element.appendChild(this.gridview.element);
|
|
3372
|
-
|
|
3373
|
-
this.layout(0, 0, true);
|
|
3398
|
+
this.layout(0, 0, true); // set some elements height/widths
|
|
3374
3399
|
this.addDisposables(this.gridview.onDidChange(() => {
|
|
3375
3400
|
this._onGridEvent.fire({ kind: exports.GroupChangeKind.LAYOUT });
|
|
3376
3401
|
}));
|
|
3377
3402
|
this.addDisposables((() => {
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
*/
|
|
3381
|
-
let timer;
|
|
3382
|
-
return this.onGridEvent((event) => {
|
|
3403
|
+
const tickDelayedEvent = new TickDelayedEvent();
|
|
3404
|
+
return new CompositeDisposable(this.onGridEvent((event) => {
|
|
3383
3405
|
if ([
|
|
3384
3406
|
exports.GroupChangeKind.ADD_GROUP,
|
|
3385
3407
|
exports.GroupChangeKind.REMOVE_GROUP,
|
|
@@ -3389,15 +3411,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3389
3411
|
exports.GroupChangeKind.PANEL_ACTIVE,
|
|
3390
3412
|
exports.GroupChangeKind.LAYOUT,
|
|
3391
3413
|
].includes(event.kind)) {
|
|
3392
|
-
|
|
3393
|
-
clearTimeout(timer);
|
|
3394
|
-
}
|
|
3395
|
-
timer = setTimeout(() => {
|
|
3396
|
-
this._onDidLayoutChange.fire();
|
|
3397
|
-
clearTimeout(timer);
|
|
3398
|
-
});
|
|
3414
|
+
tickDelayedEvent.fire();
|
|
3399
3415
|
}
|
|
3400
|
-
})
|
|
3416
|
+
}), tickDelayedEvent.onEvent(() => {
|
|
3417
|
+
this._onDidLayoutChange.fire();
|
|
3418
|
+
}), tickDelayedEvent);
|
|
3401
3419
|
})());
|
|
3402
3420
|
}
|
|
3403
3421
|
get id() {
|
|
@@ -3443,6 +3461,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3443
3461
|
doAddGroup(group, location = [0], size) {
|
|
3444
3462
|
this.gridview.addView(group, size !== null && size !== void 0 ? size : exports.Sizing.Distribute, location);
|
|
3445
3463
|
this._onGridEvent.fire({ kind: exports.GroupChangeKind.ADD_GROUP });
|
|
3464
|
+
this._onDidAddGroup.fire(group);
|
|
3446
3465
|
this.doSetGroupActive(group);
|
|
3447
3466
|
}
|
|
3448
3467
|
doRemoveGroup(group, options) {
|
|
@@ -3456,6 +3475,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3456
3475
|
this._groups.delete(group.id);
|
|
3457
3476
|
}
|
|
3458
3477
|
this._onGridEvent.fire({ kind: exports.GroupChangeKind.REMOVE_GROUP });
|
|
3478
|
+
this._onDidRemoveGroup.fire(group);
|
|
3459
3479
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
3460
3480
|
const groups = Array.from(this._groups.values());
|
|
3461
3481
|
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
@@ -3486,6 +3506,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3486
3506
|
this._onGridEvent.fire({
|
|
3487
3507
|
kind: exports.GroupChangeKind.GROUP_ACTIVE,
|
|
3488
3508
|
});
|
|
3509
|
+
this._onDidActiveGroupChange.fire(group);
|
|
3489
3510
|
}
|
|
3490
3511
|
removeGroup(group) {
|
|
3491
3512
|
this.doRemoveGroup(group);
|
|
@@ -3542,6 +3563,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3542
3563
|
dispose() {
|
|
3543
3564
|
super.dispose();
|
|
3544
3565
|
this._onGridEvent.dispose();
|
|
3566
|
+
this._onDidActiveGroupChange.dispose();
|
|
3567
|
+
this._onDidAddGroup.dispose();
|
|
3568
|
+
this._onDidRemoveGroup.dispose();
|
|
3569
|
+
this._onDidLayoutChange.dispose();
|
|
3545
3570
|
this.gridview.dispose();
|
|
3546
3571
|
}
|
|
3547
3572
|
}
|
|
@@ -3553,15 +3578,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3553
3578
|
constructor(id) {
|
|
3554
3579
|
super();
|
|
3555
3580
|
this.id = id;
|
|
3556
|
-
this._state = {};
|
|
3557
3581
|
this._isFocused = false;
|
|
3558
3582
|
this._isActive = false;
|
|
3559
3583
|
this._isVisible = true;
|
|
3560
3584
|
this._width = 0;
|
|
3561
3585
|
this._height = 0;
|
|
3562
|
-
this._onDidStateChange = new Emitter();
|
|
3563
|
-
this.onDidStateChange = this._onDidStateChange.event;
|
|
3564
|
-
//
|
|
3565
3586
|
this._onDidPanelDimensionChange = new Emitter({
|
|
3566
3587
|
replay: true,
|
|
3567
3588
|
});
|
|
@@ -3590,7 +3611,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3590
3611
|
//
|
|
3591
3612
|
this._onActiveChange = new Emitter();
|
|
3592
3613
|
this.onActiveChange = this._onActiveChange.event;
|
|
3593
|
-
this.addDisposables(this.
|
|
3614
|
+
this.addDisposables(this._onDidPanelDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onFocusEvent, this._onActiveChange, this._onVisibilityChange, this.onDidFocusChange((event) => {
|
|
3594
3615
|
this._isFocused = event.isFocused;
|
|
3595
3616
|
}), this.onDidActiveChange((event) => {
|
|
3596
3617
|
this._isActive = event.isActive;
|
|
@@ -3623,21 +3644,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3623
3644
|
setActive() {
|
|
3624
3645
|
this._onActiveChange.fire();
|
|
3625
3646
|
}
|
|
3626
|
-
setState(key, value) {
|
|
3627
|
-
if (typeof key === 'object') {
|
|
3628
|
-
this._state = key;
|
|
3629
|
-
}
|
|
3630
|
-
else if (typeof value !== undefined) {
|
|
3631
|
-
this._state[key] = value;
|
|
3632
|
-
}
|
|
3633
|
-
this._onDidStateChange.fire(undefined);
|
|
3634
|
-
}
|
|
3635
|
-
getState() {
|
|
3636
|
-
return this._state;
|
|
3637
|
-
}
|
|
3638
|
-
getStateKey(key) {
|
|
3639
|
-
return this._state[key];
|
|
3640
|
-
}
|
|
3641
3647
|
dispose() {
|
|
3642
3648
|
super.dispose();
|
|
3643
3649
|
}
|
|
@@ -3657,6 +3663,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3657
3663
|
//
|
|
3658
3664
|
this._onDidSizeChange = new Emitter();
|
|
3659
3665
|
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
3666
|
+
this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
|
|
3660
3667
|
}
|
|
3661
3668
|
setConstraints(value) {
|
|
3662
3669
|
this._onDidConstraintsChangeInternal.fire(value);
|
|
@@ -3670,19 +3677,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3670
3677
|
constructor(panel, group) {
|
|
3671
3678
|
super(panel.id);
|
|
3672
3679
|
this.panel = panel;
|
|
3673
|
-
this._onDidDirtyChange = new Emitter();
|
|
3674
|
-
this.onDidDirtyChange = this._onDidDirtyChange.event;
|
|
3675
3680
|
this._onDidTitleChange = new Emitter();
|
|
3676
3681
|
this.onDidTitleChange = this._onDidTitleChange.event;
|
|
3677
3682
|
this._titleChanged = new Emitter();
|
|
3678
3683
|
this.titleChanged = this._titleChanged.event;
|
|
3679
3684
|
this._suppressClosableChanged = new Emitter();
|
|
3680
3685
|
this.suppressClosableChanged = this._suppressClosableChanged.event;
|
|
3681
|
-
this.
|
|
3682
|
-
this.
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
3687
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
3688
|
+
this._onDidGroupChange = new Emitter();
|
|
3689
|
+
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
3690
|
+
this.disposable = new MutableDisposable();
|
|
3691
|
+
this.group = group;
|
|
3692
|
+
this.addDisposables(this.disposable, this._onDidTitleChange, this._titleChanged, this._suppressClosableChanged, this._onDidGroupChange, this._onDidActiveGroupChange);
|
|
3686
3693
|
}
|
|
3687
3694
|
get title() {
|
|
3688
3695
|
return this.panel.title;
|
|
@@ -3695,7 +3702,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3695
3702
|
return !!((_a = this.group) === null || _a === void 0 ? void 0 : _a.isActive);
|
|
3696
3703
|
}
|
|
3697
3704
|
set group(value) {
|
|
3705
|
+
const isOldGroupActive = this.isGroupActive;
|
|
3698
3706
|
this._group = value;
|
|
3707
|
+
this._onDidGroupChange.fire();
|
|
3708
|
+
if (this._group) {
|
|
3709
|
+
this.disposable.value = this._group.api.onDidActiveChange(() => {
|
|
3710
|
+
this._onDidActiveGroupChange.fire();
|
|
3711
|
+
});
|
|
3712
|
+
if (this.isGroupActive !== isOldGroupActive) {
|
|
3713
|
+
this._onDidActiveGroupChange.fire();
|
|
3714
|
+
}
|
|
3715
|
+
}
|
|
3699
3716
|
}
|
|
3700
3717
|
get group() {
|
|
3701
3718
|
return this._group;
|
|
@@ -3709,16 +3726,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3709
3726
|
}
|
|
3710
3727
|
return this.group.model.closePanel(this.panel);
|
|
3711
3728
|
}
|
|
3712
|
-
interceptOnCloseAction(interceptor) {
|
|
3713
|
-
this._interceptor = interceptor;
|
|
3714
|
-
}
|
|
3715
|
-
dispose() {
|
|
3716
|
-
super.dispose();
|
|
3717
|
-
}
|
|
3718
3729
|
}
|
|
3719
3730
|
|
|
3720
3731
|
class DockviewGroupPanel extends CompositeDisposable {
|
|
3721
|
-
constructor(id, containerApi) {
|
|
3732
|
+
constructor(id, accessor, containerApi) {
|
|
3722
3733
|
super();
|
|
3723
3734
|
this.id = id;
|
|
3724
3735
|
this.containerApi = containerApi;
|
|
@@ -3726,9 +3737,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3726
3737
|
this._suppressClosable = false;
|
|
3727
3738
|
this._title = '';
|
|
3728
3739
|
this.api = new DockviewPanelApiImpl(this, this._group);
|
|
3729
|
-
this.onDidStateChange = this.api.onDidStateChange;
|
|
3730
3740
|
this.addDisposables(this.api.onActiveChange(() => {
|
|
3731
|
-
|
|
3741
|
+
accessor.setActivePanel(this);
|
|
3732
3742
|
}), this.api.onDidTitleChange((event) => {
|
|
3733
3743
|
const title = event.title;
|
|
3734
3744
|
this.update({ params: { title } });
|
|
@@ -3752,32 +3762,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3752
3762
|
this._view = params.view;
|
|
3753
3763
|
this.setTitle(params.title);
|
|
3754
3764
|
this.setSuppressClosable(params.suppressClosable || false);
|
|
3755
|
-
if (params.state) {
|
|
3756
|
-
this.api.setState(params.state);
|
|
3757
|
-
}
|
|
3758
3765
|
(_a = this.view) === null || _a === void 0 ? void 0 : _a.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));
|
|
3759
3766
|
}
|
|
3760
3767
|
focus() {
|
|
3761
3768
|
this.api._onFocusEvent.fire();
|
|
3762
3769
|
}
|
|
3763
|
-
setDirty(isDirty) {
|
|
3764
|
-
this.api._onDidDirtyChange.fire(isDirty);
|
|
3765
|
-
}
|
|
3766
|
-
close() {
|
|
3767
|
-
if (this.api.tryClose) {
|
|
3768
|
-
return this.api.tryClose();
|
|
3769
|
-
}
|
|
3770
|
-
return Promise.resolve(true);
|
|
3771
|
-
}
|
|
3772
3770
|
toJSON() {
|
|
3773
|
-
const state = this.api.getState();
|
|
3774
3771
|
return {
|
|
3775
3772
|
id: this.id,
|
|
3776
3773
|
view: this.view.toJSON(),
|
|
3777
3774
|
params: Object.keys(this._params || {}).length > 0
|
|
3778
3775
|
? this._params
|
|
3779
3776
|
: undefined,
|
|
3780
|
-
state: state && Object.keys(state).length > 0 ? state : undefined,
|
|
3781
3777
|
suppressClosable: this.suppressClosable || undefined,
|
|
3782
3778
|
title: this.title,
|
|
3783
3779
|
};
|
|
@@ -3822,18 +3818,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3822
3818
|
var _a;
|
|
3823
3819
|
this._group = group;
|
|
3824
3820
|
this.api.group = group;
|
|
3825
|
-
this.mutableDisposable.value = this._group.model.onDidGroupChange((ev) => {
|
|
3826
|
-
var _a;
|
|
3827
|
-
if (ev.kind === exports.GroupChangeKind2.GROUP_ACTIVE) {
|
|
3828
|
-
const isVisible = !!((_a = this._group) === null || _a === void 0 ? void 0 : _a.model.isPanelActive(this));
|
|
3829
|
-
this.api._onDidActiveChange.fire({
|
|
3830
|
-
isActive: isGroupActive && isVisible,
|
|
3831
|
-
});
|
|
3832
|
-
this.api._onDidVisibilityChange.fire({
|
|
3833
|
-
isVisible,
|
|
3834
|
-
});
|
|
3835
|
-
}
|
|
3836
|
-
});
|
|
3837
3821
|
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
3838
3822
|
this.api._onDidActiveChange.fire({
|
|
3839
3823
|
isActive: isGroupActive && isPanelVisible,
|
|
@@ -3943,15 +3927,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3943
3927
|
}
|
|
3944
3928
|
}
|
|
3945
3929
|
|
|
3946
|
-
function debounce(cb, wait) {
|
|
3947
|
-
let timeout;
|
|
3948
|
-
const callable = (...args) => {
|
|
3949
|
-
clearTimeout(timeout);
|
|
3950
|
-
timeout = setTimeout(() => cb(...args), wait);
|
|
3951
|
-
};
|
|
3952
|
-
return callable;
|
|
3953
|
-
}
|
|
3954
|
-
|
|
3955
3930
|
class DefaultDeserializer {
|
|
3956
3931
|
constructor(layout, panelDeserializer) {
|
|
3957
3932
|
this.layout = layout;
|
|
@@ -4052,9 +4027,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4052
4027
|
this._isGroupActive = false;
|
|
4053
4028
|
//
|
|
4054
4029
|
this.params = {};
|
|
4055
|
-
//
|
|
4056
|
-
this.isDirtyDisposable = new MutableDisposable();
|
|
4057
|
-
this.addDisposables(this.isDirtyDisposable);
|
|
4058
4030
|
this._element = document.createElement('div');
|
|
4059
4031
|
this._element.className = 'default-tab';
|
|
4060
4032
|
//
|
|
@@ -4099,10 +4071,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4099
4071
|
init(params) {
|
|
4100
4072
|
this.params = params;
|
|
4101
4073
|
this._content.textContent = params.title;
|
|
4102
|
-
this.isDirtyDisposable.value = this.params.api.onDidDirtyChange((event) => {
|
|
4103
|
-
const isDirty = event;
|
|
4104
|
-
toggleClass(this.action, 'dirty', isDirty);
|
|
4105
|
-
});
|
|
4106
4074
|
if (!this.params.suppressClosable) {
|
|
4107
4075
|
addDisposableListener(this.action, 'click', (ev) => {
|
|
4108
4076
|
ev.preventDefault(); //
|
|
@@ -4156,6 +4124,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4156
4124
|
get height() {
|
|
4157
4125
|
return this._height;
|
|
4158
4126
|
}
|
|
4127
|
+
get params() {
|
|
4128
|
+
var _a;
|
|
4129
|
+
return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
|
|
4130
|
+
}
|
|
4159
4131
|
focus() {
|
|
4160
4132
|
this.api._onFocusEvent.fire();
|
|
4161
4133
|
}
|
|
@@ -4164,29 +4136,27 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4164
4136
|
this._height = height;
|
|
4165
4137
|
this.api._onDidPanelDimensionChange.fire({ width, height });
|
|
4166
4138
|
if (this.part) {
|
|
4167
|
-
if (this.
|
|
4168
|
-
this.part.update(this.
|
|
4139
|
+
if (this._params) {
|
|
4140
|
+
this.part.update(this._params.params);
|
|
4169
4141
|
}
|
|
4170
4142
|
}
|
|
4171
4143
|
}
|
|
4172
4144
|
init(parameters) {
|
|
4173
|
-
this.
|
|
4145
|
+
this._params = parameters;
|
|
4174
4146
|
this.part = this.getComponent();
|
|
4175
4147
|
}
|
|
4176
4148
|
update(event) {
|
|
4177
4149
|
var _a, _b;
|
|
4178
|
-
this.
|
|
4179
|
-
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this.
|
|
4150
|
+
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) });
|
|
4151
|
+
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
|
|
4180
4152
|
}
|
|
4181
4153
|
toJSON() {
|
|
4182
4154
|
var _a, _b;
|
|
4183
|
-
const
|
|
4184
|
-
const params = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
|
|
4155
|
+
const params = (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
|
|
4185
4156
|
return {
|
|
4186
4157
|
id: this.id,
|
|
4187
4158
|
component: this.component,
|
|
4188
4159
|
params: Object.keys(params).length > 0 ? params : undefined,
|
|
4189
|
-
state: Object.keys(state).length === 0 ? undefined : state,
|
|
4190
4160
|
};
|
|
4191
4161
|
}
|
|
4192
4162
|
dispose() {
|
|
@@ -4209,12 +4179,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4209
4179
|
this._snap = false;
|
|
4210
4180
|
this._onDidChange = new Emitter();
|
|
4211
4181
|
this.onDidChange = this._onDidChange.event;
|
|
4212
|
-
this.addDisposables(this.api.onVisibilityChange((event) => {
|
|
4182
|
+
this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
|
|
4213
4183
|
const { isVisible } = event;
|
|
4214
|
-
const { containerApi } = this.
|
|
4184
|
+
const { containerApi } = this._params;
|
|
4215
4185
|
containerApi.setVisible(this, isVisible);
|
|
4216
4186
|
}), this.api.onActiveChange(() => {
|
|
4217
|
-
const { containerApi } = this.
|
|
4187
|
+
const { containerApi } = this._params;
|
|
4218
4188
|
containerApi.setActive(this);
|
|
4219
4189
|
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
4220
4190
|
if (typeof event.minimumWidth === 'number' ||
|
|
@@ -4329,9 +4299,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4329
4299
|
const minimum = (value) => (value <= 0 ? undefined : value);
|
|
4330
4300
|
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 });
|
|
4331
4301
|
}
|
|
4332
|
-
dispose() {
|
|
4333
|
-
super.dispose();
|
|
4334
|
-
}
|
|
4335
4302
|
}
|
|
4336
4303
|
|
|
4337
4304
|
class GroupviewPanel extends GridviewPanel {
|
|
@@ -4403,7 +4370,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4403
4370
|
this.tab.init(params);
|
|
4404
4371
|
}
|
|
4405
4372
|
updateParentGroup(group, isPanelVisible) {
|
|
4406
|
-
|
|
4373
|
+
var _a;
|
|
4374
|
+
this._content.updateParentGroup(group, isPanelVisible);
|
|
4375
|
+
(_a = this._tab) === null || _a === void 0 ? void 0 : _a.updateParentGroup(group, isPanelVisible);
|
|
4407
4376
|
}
|
|
4408
4377
|
layout(width, height) {
|
|
4409
4378
|
this.content.layout(width, height);
|
|
@@ -4436,15 +4405,22 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4436
4405
|
orientation: options.orientation || exports.Orientation.HORIZONTAL,
|
|
4437
4406
|
styles: options.styles,
|
|
4438
4407
|
});
|
|
4439
|
-
this._panels = new Map();
|
|
4440
|
-
this.dirtyPanels = new Set();
|
|
4441
|
-
this.debouncedDeque = debounce(this.syncConfigs.bind(this), 5000);
|
|
4442
4408
|
// events
|
|
4443
4409
|
this._onTabInteractionEvent = new Emitter();
|
|
4444
4410
|
this.onTabInteractionEvent = this._onTabInteractionEvent.event;
|
|
4445
4411
|
this._onTabContextMenu = new Emitter();
|
|
4446
4412
|
this.onTabContextMenu = this._onTabContextMenu.event;
|
|
4447
|
-
this.
|
|
4413
|
+
this._onDidDrop = new Emitter();
|
|
4414
|
+
this.onDidDrop = this._onDidDrop.event;
|
|
4415
|
+
this._onDidRemovePanel = new Emitter();
|
|
4416
|
+
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
4417
|
+
this._onDidAddPanel = new Emitter();
|
|
4418
|
+
this.onDidAddPanel = this._onDidAddPanel.event;
|
|
4419
|
+
this._onDidLayoutfromJSON = new Emitter();
|
|
4420
|
+
this.onDidLayoutfromJSON = this._onDidLayoutfromJSON.event;
|
|
4421
|
+
this._onDidActivePanelChange = new Emitter();
|
|
4422
|
+
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
4423
|
+
this.addDisposables(this._onTabInteractionEvent, this._onTabContextMenu, this._onDidDrop);
|
|
4448
4424
|
this._options = options;
|
|
4449
4425
|
if (!this.options.components) {
|
|
4450
4426
|
this.options.components = {};
|
|
@@ -4465,10 +4441,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4465
4441
|
this._api = new DockviewApi(this);
|
|
4466
4442
|
}
|
|
4467
4443
|
get totalPanels() {
|
|
4468
|
-
return this.
|
|
4444
|
+
return this.panels.length;
|
|
4469
4445
|
}
|
|
4470
4446
|
get panels() {
|
|
4471
|
-
return
|
|
4447
|
+
return this.groups.flatMap((group) => group.model.panels);
|
|
4472
4448
|
}
|
|
4473
4449
|
get deserializer() {
|
|
4474
4450
|
return this._deserializer;
|
|
@@ -4498,10 +4474,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4498
4474
|
updateOptions(options) {
|
|
4499
4475
|
const hasOrientationChanged = typeof options.orientation === 'string' &&
|
|
4500
4476
|
this.options.orientation !== options.orientation;
|
|
4501
|
-
// TODO support style update
|
|
4502
|
-
// const hasStylesChanged =
|
|
4503
|
-
// typeof options.styles === 'object' &&
|
|
4504
|
-
// this.options.styles !== options.styles;
|
|
4505
4477
|
this._options = Object.assign(Object.assign({}, this.options), options);
|
|
4506
4478
|
if (hasOrientationChanged) {
|
|
4507
4479
|
this.gridview.orientation = options.orientation;
|
|
@@ -4513,8 +4485,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4513
4485
|
(_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
|
|
4514
4486
|
}
|
|
4515
4487
|
getGroupPanel(id) {
|
|
4516
|
-
|
|
4517
|
-
return (_a = this._panels.get(id)) === null || _a === void 0 ? void 0 : _a.value;
|
|
4488
|
+
return this.panels.find((panel) => panel.id === id);
|
|
4518
4489
|
}
|
|
4519
4490
|
setActivePanel(panel) {
|
|
4520
4491
|
if (!panel.group) {
|
|
@@ -4563,24 +4534,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4563
4534
|
this.doSetGroupActive(next);
|
|
4564
4535
|
}
|
|
4565
4536
|
}
|
|
4566
|
-
registerPanel(panel) {
|
|
4567
|
-
if (this._panels.has(panel.id)) {
|
|
4568
|
-
throw new Error(`panel ${panel.id} already exists`);
|
|
4569
|
-
}
|
|
4570
|
-
const disposable = new CompositeDisposable(panel.onDidStateChange(() => this.addDirtyPanel(panel)));
|
|
4571
|
-
this._panels.set(panel.id, { value: panel, disposable });
|
|
4572
|
-
}
|
|
4573
|
-
unregisterPanel(panel) {
|
|
4574
|
-
if (!this._panels.has(panel.id)) {
|
|
4575
|
-
throw new Error(`panel ${panel.id} doesn't exist`);
|
|
4576
|
-
}
|
|
4577
|
-
const item = this._panels.get(panel.id);
|
|
4578
|
-
if (item) {
|
|
4579
|
-
item.disposable.dispose();
|
|
4580
|
-
item.value.dispose();
|
|
4581
|
-
}
|
|
4582
|
-
this._panels.delete(panel.id);
|
|
4583
|
-
}
|
|
4584
4537
|
/**
|
|
4585
4538
|
* Serialize the current state of the layout
|
|
4586
4539
|
*
|
|
@@ -4588,12 +4541,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4588
4541
|
*/
|
|
4589
4542
|
toJSON() {
|
|
4590
4543
|
var _a;
|
|
4591
|
-
this.syncConfigs();
|
|
4592
4544
|
const data = this.gridview.serialize();
|
|
4593
|
-
const panels =
|
|
4594
|
-
|
|
4595
|
-
collection[panel.value.id] = panel.value.toJSON();
|
|
4596
|
-
}
|
|
4545
|
+
const panels = this.panels.reduce((collection, panel) => {
|
|
4546
|
+
collection[panel.id] = panel.toJSON();
|
|
4597
4547
|
return collection;
|
|
4598
4548
|
}, {});
|
|
4599
4549
|
return {
|
|
@@ -4605,11 +4555,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4605
4555
|
}
|
|
4606
4556
|
fromJSON(data) {
|
|
4607
4557
|
this.gridview.clear();
|
|
4608
|
-
this.
|
|
4609
|
-
panel.
|
|
4610
|
-
panel.value.dispose();
|
|
4558
|
+
this.panels.forEach((panel) => {
|
|
4559
|
+
panel.dispose();
|
|
4611
4560
|
});
|
|
4612
|
-
this._panels.clear();
|
|
4613
4561
|
this._groups.clear();
|
|
4614
4562
|
if (!this.deserializer) {
|
|
4615
4563
|
throw new Error('invalid deserializer');
|
|
@@ -4624,9 +4572,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4624
4572
|
this.gridview.deserialize(grid, new DefaultDeserializer(this, {
|
|
4625
4573
|
createPanel: (id) => {
|
|
4626
4574
|
const panelData = panels[id];
|
|
4627
|
-
|
|
4628
|
-
this.registerPanel(panel);
|
|
4629
|
-
return panel;
|
|
4575
|
+
return this.deserializer.fromJSON(panelData);
|
|
4630
4576
|
},
|
|
4631
4577
|
}));
|
|
4632
4578
|
if (typeof activeGroup === 'string') {
|
|
@@ -4637,30 +4583,23 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4637
4583
|
}
|
|
4638
4584
|
this.gridview.layout(this.width, this.height);
|
|
4639
4585
|
this._onGridEvent.fire({ kind: exports.GroupChangeKind.LAYOUT_FROM_JSON });
|
|
4586
|
+
this._onDidLayoutfromJSON.fire();
|
|
4640
4587
|
}
|
|
4641
4588
|
closeAllGroups() {
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
if (!didCloseAll) {
|
|
4647
|
-
return false;
|
|
4648
|
-
}
|
|
4649
|
-
}
|
|
4650
|
-
return true;
|
|
4651
|
-
});
|
|
4589
|
+
for (const entry of this._groups.entries()) {
|
|
4590
|
+
const [_, group] = entry;
|
|
4591
|
+
group.value.model.closeAllPanels();
|
|
4592
|
+
}
|
|
4652
4593
|
}
|
|
4653
4594
|
fireMouseEvent(event) {
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
}
|
|
4663
|
-
break;
|
|
4595
|
+
if (event.kind === exports.MouseEventKind.CONTEXT_MENU) {
|
|
4596
|
+
if (event.tab && event.panel) {
|
|
4597
|
+
this._onTabContextMenu.fire({
|
|
4598
|
+
event: event.event,
|
|
4599
|
+
api: this._api,
|
|
4600
|
+
panel: event.panel,
|
|
4601
|
+
});
|
|
4602
|
+
}
|
|
4664
4603
|
}
|
|
4665
4604
|
}
|
|
4666
4605
|
addPanel(options) {
|
|
@@ -4694,7 +4633,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4694
4633
|
return panel;
|
|
4695
4634
|
}
|
|
4696
4635
|
removePanel(panel) {
|
|
4697
|
-
this.unregisterPanel(panel);
|
|
4698
4636
|
const group = panel.group;
|
|
4699
4637
|
if (!group) {
|
|
4700
4638
|
throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
|
|
@@ -4713,10 +4651,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4713
4651
|
: {}, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.watermark);
|
|
4714
4652
|
}
|
|
4715
4653
|
addEmptyGroup(options) {
|
|
4716
|
-
var _a;
|
|
4717
4654
|
const group = this.createGroup();
|
|
4718
4655
|
if (options) {
|
|
4719
|
-
const referencePanel =
|
|
4656
|
+
const referencePanel = this.panels.find((panel) => panel.id === options.referencePanel);
|
|
4720
4657
|
if (!referencePanel) {
|
|
4721
4658
|
throw new Error(`reference panel ${options.referencePanel} does not exist`);
|
|
4722
4659
|
}
|
|
@@ -4745,13 +4682,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4745
4682
|
super.removeGroup(group);
|
|
4746
4683
|
}
|
|
4747
4684
|
moveGroupOrPanel(referenceGroup, groupId, itemId, target, index) {
|
|
4748
|
-
var _a
|
|
4685
|
+
var _a;
|
|
4749
4686
|
const sourceGroup = groupId
|
|
4750
4687
|
? (_a = this._groups.get(groupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
4751
4688
|
: undefined;
|
|
4752
4689
|
if (!target || target === exports.Position.Center) {
|
|
4753
4690
|
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(itemId)) ||
|
|
4754
|
-
|
|
4691
|
+
this.panels.find((panel) => panel.id === itemId);
|
|
4755
4692
|
if (!groupItem) {
|
|
4756
4693
|
throw new Error(`No panel with id ${itemId}`);
|
|
4757
4694
|
}
|
|
@@ -4787,7 +4724,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4787
4724
|
}
|
|
4788
4725
|
else {
|
|
4789
4726
|
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(itemId)) ||
|
|
4790
|
-
|
|
4727
|
+
this.panels.find((panel) => panel.id === itemId);
|
|
4791
4728
|
if (!groupItem) {
|
|
4792
4729
|
throw new Error(`No panel with id ${itemId}`);
|
|
4793
4730
|
}
|
|
@@ -4797,7 +4734,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4797
4734
|
}
|
|
4798
4735
|
}
|
|
4799
4736
|
doSetGroupActive(group, skipFocus) {
|
|
4800
|
-
var _a, _b;
|
|
4737
|
+
var _a, _b, _c;
|
|
4801
4738
|
const isGroupAlreadyFocused = this._activeGroup === group;
|
|
4802
4739
|
super.doSetGroupActive(group, skipFocus);
|
|
4803
4740
|
if (!isGroupAlreadyFocused && ((_a = this._activeGroup) === null || _a === void 0 ? void 0 : _a.model.activePanel)) {
|
|
@@ -4805,6 +4742,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4805
4742
|
kind: exports.GroupChangeKind.PANEL_ACTIVE,
|
|
4806
4743
|
panel: (_b = this._activeGroup) === null || _b === void 0 ? void 0 : _b.model.activePanel,
|
|
4807
4744
|
});
|
|
4745
|
+
this._onDidActivePanelChange.fire((_c = this._activeGroup) === null || _c === void 0 ? void 0 : _c.model.activePanel);
|
|
4808
4746
|
}
|
|
4809
4747
|
}
|
|
4810
4748
|
createGroup(options) {
|
|
@@ -4830,6 +4768,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4830
4768
|
const disposable = new CompositeDisposable(view.model.onMove((event) => {
|
|
4831
4769
|
const { groupId, itemId, target, index } = event;
|
|
4832
4770
|
this.moveGroupOrPanel(view, groupId, itemId, target, index);
|
|
4771
|
+
}), view.model.onDidDrop((event) => {
|
|
4772
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api }));
|
|
4833
4773
|
}), view.model.onDidGroupChange((event) => {
|
|
4834
4774
|
switch (event.kind) {
|
|
4835
4775
|
case exports.GroupChangeKind2.ADD_PANEL:
|
|
@@ -4837,24 +4777,25 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4837
4777
|
kind: exports.GroupChangeKind.ADD_PANEL,
|
|
4838
4778
|
panel: event.panel,
|
|
4839
4779
|
});
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
kind: exports.GroupChangeKind.GROUP_ACTIVE,
|
|
4844
|
-
panel: event.panel,
|
|
4845
|
-
});
|
|
4780
|
+
if (event.panel) {
|
|
4781
|
+
this._onDidAddPanel.fire(event.panel);
|
|
4782
|
+
}
|
|
4846
4783
|
break;
|
|
4847
4784
|
case exports.GroupChangeKind2.REMOVE_PANEL:
|
|
4848
4785
|
this._onGridEvent.fire({
|
|
4849
4786
|
kind: exports.GroupChangeKind.REMOVE_PANEL,
|
|
4850
4787
|
panel: event.panel,
|
|
4851
4788
|
});
|
|
4789
|
+
if (event.panel) {
|
|
4790
|
+
this._onDidRemovePanel.fire(event.panel);
|
|
4791
|
+
}
|
|
4852
4792
|
break;
|
|
4853
4793
|
case exports.GroupChangeKind2.PANEL_ACTIVE:
|
|
4854
4794
|
this._onGridEvent.fire({
|
|
4855
4795
|
kind: exports.GroupChangeKind.PANEL_ACTIVE,
|
|
4856
4796
|
panel: event.panel,
|
|
4857
4797
|
});
|
|
4798
|
+
this._onDidActivePanelChange.fire(event.panel);
|
|
4858
4799
|
break;
|
|
4859
4800
|
}
|
|
4860
4801
|
}));
|
|
@@ -4868,44 +4809,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4868
4809
|
}
|
|
4869
4810
|
return view;
|
|
4870
4811
|
}
|
|
4871
|
-
dispose() {
|
|
4872
|
-
super.dispose();
|
|
4873
|
-
this._onGridEvent.dispose();
|
|
4874
|
-
}
|
|
4875
|
-
/**
|
|
4876
|
-
* Ensure the local copy of the layout state is up-to-date
|
|
4877
|
-
*/
|
|
4878
|
-
syncConfigs() {
|
|
4879
|
-
const dirtyPanels = Array.from(this.dirtyPanels);
|
|
4880
|
-
if (dirtyPanels.length === 0) ;
|
|
4881
|
-
this.dirtyPanels.clear();
|
|
4882
|
-
const partialPanelState = dirtyPanels
|
|
4883
|
-
.map((panel) => this._panels.get(panel.id))
|
|
4884
|
-
.filter((_) => !!_)
|
|
4885
|
-
.reduce((collection, panel) => {
|
|
4886
|
-
collection[panel.value.id] = panel.value.toJSON();
|
|
4887
|
-
return collection;
|
|
4888
|
-
}, {});
|
|
4889
|
-
this.panelState = Object.assign(Object.assign({}, this.panelState), partialPanelState);
|
|
4890
|
-
dirtyPanels
|
|
4891
|
-
.filter((p) => this._panels.has(p.id))
|
|
4892
|
-
.forEach((panel) => {
|
|
4893
|
-
panel.setDirty(false);
|
|
4894
|
-
});
|
|
4895
|
-
}
|
|
4896
4812
|
_addPanel(options) {
|
|
4897
4813
|
const view = new DefaultGroupPanelView({
|
|
4898
4814
|
content: this.createContentComponent(options.id, options.component),
|
|
4899
4815
|
tab: this.createTabComponent(options.id, options.tabComponent),
|
|
4900
4816
|
});
|
|
4901
|
-
const panel = new DockviewGroupPanel(options.id, this._api);
|
|
4817
|
+
const panel = new DockviewGroupPanel(options.id, this, this._api);
|
|
4902
4818
|
panel.init({
|
|
4903
4819
|
view,
|
|
4904
4820
|
title: options.title || options.id,
|
|
4905
4821
|
suppressClosable: options === null || options === void 0 ? void 0 : options.suppressClosable,
|
|
4906
4822
|
params: (options === null || options === void 0 ? void 0 : options.params) || {},
|
|
4907
4823
|
});
|
|
4908
|
-
this.registerPanel(panel);
|
|
4909
4824
|
return panel;
|
|
4910
4825
|
}
|
|
4911
4826
|
createContentComponent(id, componentName) {
|
|
@@ -4925,10 +4840,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4925
4840
|
var _a;
|
|
4926
4841
|
return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
|
|
4927
4842
|
}
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
this.
|
|
4843
|
+
dispose() {
|
|
4844
|
+
super.dispose();
|
|
4845
|
+
this._onDidActivePanelChange.dispose();
|
|
4846
|
+
this._onDidAddPanel.dispose();
|
|
4847
|
+
this._onDidRemovePanel.dispose();
|
|
4848
|
+
this._onDidLayoutfromJSON.dispose();
|
|
4932
4849
|
}
|
|
4933
4850
|
}
|
|
4934
4851
|
|
|
@@ -4939,6 +4856,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4939
4856
|
orientation: options.orientation,
|
|
4940
4857
|
styles: options.styles,
|
|
4941
4858
|
});
|
|
4859
|
+
this._onDidLayoutfromJSON = new Emitter();
|
|
4860
|
+
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
4942
4861
|
this._options = options;
|
|
4943
4862
|
if (!this.options.components) {
|
|
4944
4863
|
this.options.components = {};
|
|
@@ -5047,6 +4966,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5047
4966
|
}
|
|
5048
4967
|
}
|
|
5049
4968
|
this._onGridEvent.fire({ kind: exports.GroupChangeKind.LAYOUT_FROM_JSON });
|
|
4969
|
+
this._onDidLayoutfromJSON.fire();
|
|
5050
4970
|
}
|
|
5051
4971
|
movePanel(panel, options) {
|
|
5052
4972
|
var _a;
|
|
@@ -5161,6 +5081,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5161
5081
|
}
|
|
5162
5082
|
dispose() {
|
|
5163
5083
|
super.dispose();
|
|
5084
|
+
this._onDidLayoutfromJSON.dispose();
|
|
5164
5085
|
}
|
|
5165
5086
|
}
|
|
5166
5087
|
|
|
@@ -5173,6 +5094,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5173
5094
|
this.element = element;
|
|
5174
5095
|
this._disposable = new MutableDisposable();
|
|
5175
5096
|
this.panels = new Map();
|
|
5097
|
+
this._onDidAddView = new Emitter();
|
|
5098
|
+
this.onDidAddView = this._onDidAddView.event;
|
|
5099
|
+
this._onDidRemoveView = new Emitter();
|
|
5100
|
+
this.onDidRemoveView = this._onDidRemoveView.event;
|
|
5176
5101
|
this._onDidLayoutChange = new Emitter();
|
|
5177
5102
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
5178
5103
|
this._options = options;
|
|
@@ -5183,7 +5108,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5183
5108
|
options.frameworkComponents = {};
|
|
5184
5109
|
}
|
|
5185
5110
|
this.splitview = new Splitview(this.element, options);
|
|
5186
|
-
this.addDisposables(this._disposable);
|
|
5111
|
+
this.addDisposables(this._disposable, this._onDidAddView, this._onDidRemoveView, this._onDidLayoutChange);
|
|
5187
5112
|
}
|
|
5188
5113
|
get options() {
|
|
5189
5114
|
return this._options;
|
|
@@ -5198,7 +5123,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5198
5123
|
this._splitview = value;
|
|
5199
5124
|
this._disposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
|
|
5200
5125
|
this._onDidLayoutChange.fire(undefined);
|
|
5201
|
-
}));
|
|
5126
|
+
}), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
|
|
5202
5127
|
}
|
|
5203
5128
|
get minimumSize() {
|
|
5204
5129
|
return this.splitview.minimumSize;
|
|
@@ -5372,6 +5297,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5372
5297
|
});
|
|
5373
5298
|
panel.orientation = orientation;
|
|
5374
5299
|
this.doAddView(panel);
|
|
5300
|
+
setTimeout(() => {
|
|
5301
|
+
// the original onDidAddView events are missed since they are fired before we can subcribe to them
|
|
5302
|
+
this._onDidAddView.fire(panel);
|
|
5303
|
+
}, 0);
|
|
5375
5304
|
return { size: view.size, view: panel };
|
|
5376
5305
|
}),
|
|
5377
5306
|
},
|
|
@@ -5401,41 +5330,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5401
5330
|
}
|
|
5402
5331
|
}
|
|
5403
5332
|
|
|
5404
|
-
class DragHandler extends CompositeDisposable {
|
|
5405
|
-
constructor(el) {
|
|
5406
|
-
super();
|
|
5407
|
-
this.el = el;
|
|
5408
|
-
this.iframes = [];
|
|
5409
|
-
this._onDragStart = new Emitter();
|
|
5410
|
-
this.onDragStart = this._onDragStart.event;
|
|
5411
|
-
this.configure();
|
|
5412
|
-
}
|
|
5413
|
-
configure() {
|
|
5414
|
-
this.addDisposables(addDisposableListener(this.el, 'dragstart', (event) => {
|
|
5415
|
-
var _a;
|
|
5416
|
-
this.iframes = [
|
|
5417
|
-
...getElementsByTagName('iframe'),
|
|
5418
|
-
...getElementsByTagName('webview'),
|
|
5419
|
-
];
|
|
5420
|
-
for (const iframe of this.iframes) {
|
|
5421
|
-
iframe.style.pointerEvents = 'none';
|
|
5422
|
-
}
|
|
5423
|
-
this.el.classList.add('dragged');
|
|
5424
|
-
setTimeout(() => this.el.classList.remove('dragged'), 0);
|
|
5425
|
-
(_a = this.disposable) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
5426
|
-
this.disposable = this.getData();
|
|
5427
|
-
}), addDisposableListener(this.el, 'dragend', (ev) => {
|
|
5428
|
-
var _a;
|
|
5429
|
-
for (const iframe of this.iframes) {
|
|
5430
|
-
iframe.style.pointerEvents = 'auto';
|
|
5431
|
-
}
|
|
5432
|
-
this.iframes = [];
|
|
5433
|
-
(_a = this.disposable) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
5434
|
-
this.disposable = undefined;
|
|
5435
|
-
}));
|
|
5436
|
-
}
|
|
5437
|
-
}
|
|
5438
|
-
|
|
5439
5333
|
class SplitviewPanelApiImpl extends PanelApiImpl {
|
|
5440
5334
|
//
|
|
5441
5335
|
constructor(id) {
|
|
@@ -5450,6 +5344,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5450
5344
|
//
|
|
5451
5345
|
this._onDidSizeChange = new Emitter();
|
|
5452
5346
|
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
5347
|
+
this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
|
|
5453
5348
|
}
|
|
5454
5349
|
setConstraints(value) {
|
|
5455
5350
|
this._onDidConstraintsChangeInternal.fire(value);
|
|
@@ -5457,11 +5352,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5457
5352
|
setSize(event) {
|
|
5458
5353
|
this._onDidSizeChange.fire(event);
|
|
5459
5354
|
}
|
|
5460
|
-
dispose() {
|
|
5461
|
-
super.dispose();
|
|
5462
|
-
this._onDidConstraintsChange.dispose();
|
|
5463
|
-
this._onDidSizeChange.dispose();
|
|
5464
|
-
}
|
|
5465
5355
|
}
|
|
5466
5356
|
|
|
5467
5357
|
class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
|
|
@@ -5475,6 +5365,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5475
5365
|
this.onMouseEnter = this._onMouseEnter.event;
|
|
5476
5366
|
this._onMouseLeave = new Emitter({});
|
|
5477
5367
|
this.onMouseLeave = this._onMouseLeave.event;
|
|
5368
|
+
this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
|
|
5478
5369
|
}
|
|
5479
5370
|
set pane(pane) {
|
|
5480
5371
|
this._pane = pane;
|
|
@@ -5490,7 +5381,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5490
5381
|
}
|
|
5491
5382
|
|
|
5492
5383
|
class PaneviewPanel extends BasePanelView {
|
|
5493
|
-
constructor(id, component, headerComponent, orientation, isExpanded) {
|
|
5384
|
+
constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
|
|
5494
5385
|
super(id, component, new PaneviewPanelApiImpl(id));
|
|
5495
5386
|
this.headerComponent = headerComponent;
|
|
5496
5387
|
this._onDidChangeExpansionState = new Emitter({ replay: true });
|
|
@@ -5506,6 +5397,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5506
5397
|
this.expandedSize = 0;
|
|
5507
5398
|
this.api.pane = this; // TODO cannot use 'this' before 'super'
|
|
5508
5399
|
this._isExpanded = isExpanded;
|
|
5400
|
+
this._headerVisible = isHeaderVisible;
|
|
5509
5401
|
this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
|
|
5510
5402
|
this._orientation = orientation;
|
|
5511
5403
|
this.element.classList.add('pane');
|
|
@@ -5573,6 +5465,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5573
5465
|
this._maximumBodySize =
|
|
5574
5466
|
typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
|
|
5575
5467
|
}
|
|
5468
|
+
get headerVisible() {
|
|
5469
|
+
return this._headerVisible;
|
|
5470
|
+
}
|
|
5471
|
+
set headerVisible(value) {
|
|
5472
|
+
this._headerVisible = value;
|
|
5473
|
+
this.header.style.display = value ? '' : 'none';
|
|
5474
|
+
}
|
|
5576
5475
|
setVisible(isVisible) {
|
|
5577
5476
|
this.api._onDidVisibilityChange.fire({ isVisible });
|
|
5578
5477
|
}
|
|
@@ -5635,7 +5534,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5635
5534
|
}
|
|
5636
5535
|
}
|
|
5637
5536
|
toJSON() {
|
|
5638
|
-
const params = this.
|
|
5537
|
+
const params = this._params;
|
|
5639
5538
|
return Object.assign(Object.assign({}, super.toJSON()), { headerComponent: this.headerComponent, title: params.title });
|
|
5640
5539
|
}
|
|
5641
5540
|
renderOnce() {
|
|
@@ -5670,7 +5569,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5670
5569
|
|
|
5671
5570
|
class DraggablePaneviewPanel extends PaneviewPanel {
|
|
5672
5571
|
constructor(id, component, headerComponent, orientation, isExpanded, disableDnd) {
|
|
5673
|
-
super(id, component, headerComponent, orientation, isExpanded);
|
|
5572
|
+
super(id, component, headerComponent, orientation, isExpanded, true);
|
|
5674
5573
|
this._onDidDrop = new Emitter();
|
|
5675
5574
|
this.onDidDrop = this._onDidDrop.event;
|
|
5676
5575
|
if (!disableDnd) {
|
|
@@ -5704,36 +5603,39 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5704
5603
|
},
|
|
5705
5604
|
});
|
|
5706
5605
|
this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
|
|
5707
|
-
|
|
5708
|
-
if (!data) {
|
|
5709
|
-
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: () => getPaneData() }));
|
|
5710
|
-
return;
|
|
5711
|
-
}
|
|
5712
|
-
const containerApi = this.params
|
|
5713
|
-
.containerApi;
|
|
5714
|
-
const panelId = data.paneId;
|
|
5715
|
-
const existingPanel = containerApi.getPanel(panelId);
|
|
5716
|
-
if (!existingPanel) {
|
|
5717
|
-
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: () => getPaneData() }));
|
|
5718
|
-
return;
|
|
5719
|
-
}
|
|
5720
|
-
const allPanels = containerApi.getPanels();
|
|
5721
|
-
const fromIndex = allPanels.indexOf(existingPanel);
|
|
5722
|
-
let toIndex = containerApi.getPanels().indexOf(this);
|
|
5723
|
-
if (event.position === exports.Position.Left ||
|
|
5724
|
-
event.position === exports.Position.Top) {
|
|
5725
|
-
toIndex = Math.max(0, toIndex - 1);
|
|
5726
|
-
}
|
|
5727
|
-
if (event.position === exports.Position.Right ||
|
|
5728
|
-
event.position === exports.Position.Bottom) {
|
|
5729
|
-
if (fromIndex > toIndex) {
|
|
5730
|
-
toIndex++;
|
|
5731
|
-
}
|
|
5732
|
-
toIndex = Math.min(allPanels.length - 1, toIndex);
|
|
5733
|
-
}
|
|
5734
|
-
containerApi.movePanel(fromIndex, toIndex);
|
|
5606
|
+
this.onDrop(event);
|
|
5735
5607
|
}));
|
|
5736
5608
|
}
|
|
5609
|
+
onDrop(event) {
|
|
5610
|
+
const data = getPaneData();
|
|
5611
|
+
if (!data) {
|
|
5612
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: () => getPaneData() }));
|
|
5613
|
+
return;
|
|
5614
|
+
}
|
|
5615
|
+
const containerApi = this._params
|
|
5616
|
+
.containerApi;
|
|
5617
|
+
const panelId = data.paneId;
|
|
5618
|
+
const existingPanel = containerApi.getPanel(panelId);
|
|
5619
|
+
if (!existingPanel) {
|
|
5620
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: () => getPaneData() }));
|
|
5621
|
+
return;
|
|
5622
|
+
}
|
|
5623
|
+
const allPanels = containerApi.getPanels();
|
|
5624
|
+
const fromIndex = allPanels.indexOf(existingPanel);
|
|
5625
|
+
let toIndex = containerApi.getPanels().indexOf(this);
|
|
5626
|
+
if (event.position === exports.Position.Left ||
|
|
5627
|
+
event.position === exports.Position.Top) {
|
|
5628
|
+
toIndex = Math.max(0, toIndex - 1);
|
|
5629
|
+
}
|
|
5630
|
+
if (event.position === exports.Position.Right ||
|
|
5631
|
+
event.position === exports.Position.Bottom) {
|
|
5632
|
+
if (fromIndex > toIndex) {
|
|
5633
|
+
toIndex++;
|
|
5634
|
+
}
|
|
5635
|
+
toIndex = Math.min(allPanels.length - 1, toIndex);
|
|
5636
|
+
}
|
|
5637
|
+
containerApi.movePanel(fromIndex, toIndex);
|
|
5638
|
+
}
|
|
5737
5639
|
}
|
|
5738
5640
|
|
|
5739
5641
|
class DefaultHeader extends CompositeDisposable {
|
|
@@ -5793,6 +5695,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5793
5695
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
5794
5696
|
this._onDidDrop = new Emitter();
|
|
5795
5697
|
this.onDidDrop = this._onDidDrop.event;
|
|
5698
|
+
this._onDidAddView = new Emitter();
|
|
5699
|
+
this.onDidAddView = this._onDidAddView.event;
|
|
5700
|
+
this._onDidRemoveView = new Emitter();
|
|
5701
|
+
this.onDidRemoveView = this._onDidRemoveView.event;
|
|
5702
|
+
this.addDisposables(this._onDidLayoutChange, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
|
|
5796
5703
|
this._options = options;
|
|
5797
5704
|
if (!options.components) {
|
|
5798
5705
|
options.components = {};
|
|
@@ -5806,17 +5713,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5806
5713
|
});
|
|
5807
5714
|
this.addDisposables(this._disposable);
|
|
5808
5715
|
}
|
|
5809
|
-
get onDidAddView() {
|
|
5810
|
-
return this._paneview.onDidAddView;
|
|
5811
|
-
}
|
|
5812
|
-
get onDidRemoveView() {
|
|
5813
|
-
return this._paneview.onDidRemoveView;
|
|
5814
|
-
}
|
|
5815
5716
|
set paneview(value) {
|
|
5816
5717
|
this._paneview = value;
|
|
5817
|
-
this._disposable.value = new CompositeDisposable(this.
|
|
5718
|
+
this._disposable.value = new CompositeDisposable(this._paneview.onDidChange(() => {
|
|
5818
5719
|
this._onDidLayoutChange.fire(undefined);
|
|
5819
|
-
}));
|
|
5720
|
+
}), this._paneview.onDidAddView((e) => this._onDidAddView.fire(e)), this._paneview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
|
|
5820
5721
|
}
|
|
5821
5722
|
get paneview() {
|
|
5822
5723
|
return this._paneview;
|
|
@@ -5996,6 +5897,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5996
5897
|
});
|
|
5997
5898
|
panel.orientation = this.paneview.orientation;
|
|
5998
5899
|
});
|
|
5900
|
+
setTimeout(() => {
|
|
5901
|
+
// the original onDidAddView events are missed since they are fired before we can subcribe to them
|
|
5902
|
+
this._onDidAddView.fire(panel);
|
|
5903
|
+
}, 0);
|
|
5999
5904
|
return { size: view.size, view: panel };
|
|
6000
5905
|
}),
|
|
6001
5906
|
},
|
|
@@ -6022,12 +5927,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6022
5927
|
this._snap = false;
|
|
6023
5928
|
this._onDidChange = new Emitter();
|
|
6024
5929
|
this.onDidChange = this._onDidChange.event;
|
|
6025
|
-
this.addDisposables(this.api.onVisibilityChange((event) => {
|
|
5930
|
+
this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
|
|
6026
5931
|
const { isVisible } = event;
|
|
6027
|
-
const { containerApi } = this
|
|
5932
|
+
const { containerApi } = this
|
|
5933
|
+
._params;
|
|
6028
5934
|
containerApi.setVisible(this, isVisible);
|
|
6029
5935
|
}), this.api.onActiveChange(() => {
|
|
6030
|
-
const { containerApi } = this
|
|
5936
|
+
const { containerApi } = this
|
|
5937
|
+
._params;
|
|
6031
5938
|
containerApi.setActive(this);
|
|
6032
5939
|
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
6033
5940
|
if (typeof event.minimumSize === 'number' ||
|
|
@@ -6170,14 +6077,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6170
6077
|
if (this.disposed) {
|
|
6171
6078
|
throw new Error('invalid operation: resource is already disposed');
|
|
6172
6079
|
}
|
|
6173
|
-
// TODO use a better check for isReactFunctionalComponent
|
|
6174
6080
|
if (typeof this.component !== 'function') {
|
|
6175
6081
|
/**
|
|
6176
6082
|
* we know this isn't a React.FunctionComponent so throw an error here.
|
|
6177
6083
|
* if we do not intercept this the React library will throw a very obsure error
|
|
6178
6084
|
* for the same reason, at least at this point we will emit a sensible stacktrace.
|
|
6179
6085
|
*/
|
|
6180
|
-
throw new Error('
|
|
6086
|
+
throw new Error('Invalid Operation. dockview only supports React Functional Components.');
|
|
6181
6087
|
}
|
|
6182
6088
|
const bridgeComponent = React__namespace.createElement(React__namespace.forwardRef(ReactComponentBridge), {
|
|
6183
6089
|
component: this
|
|
@@ -6241,16 +6147,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6241
6147
|
this._onDidBlur = new Emitter();
|
|
6242
6148
|
this.onDidBlur = this._onDidBlur.event;
|
|
6243
6149
|
this._element = document.createElement('div');
|
|
6244
|
-
this._element.
|
|
6245
|
-
this._element.style.width = '100%';
|
|
6150
|
+
this._element.className = 'dockview-react-part';
|
|
6246
6151
|
// this.hostedContainer = new HostedContainer({
|
|
6247
6152
|
// id,
|
|
6248
6153
|
// });
|
|
6249
6154
|
// this.hostedContainer.onDidFocus(() => this._onDidFocus.fire());
|
|
6250
6155
|
// this.hostedContainer.onDidBlur(() => this._onDidBlur.fire());
|
|
6251
6156
|
this._actionsElement = document.createElement('div');
|
|
6252
|
-
this._actionsElement.
|
|
6253
|
-
this._actionsElement.style.width = '100%';
|
|
6157
|
+
this._actionsElement.className = 'dockview-react-part';
|
|
6254
6158
|
}
|
|
6255
6159
|
get element() {
|
|
6256
6160
|
return this._element;
|
|
@@ -6298,6 +6202,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6298
6202
|
}
|
|
6299
6203
|
dispose() {
|
|
6300
6204
|
var _a, _b;
|
|
6205
|
+
this._onDidFocus.dispose();
|
|
6206
|
+
this._onDidBlur.dispose();
|
|
6301
6207
|
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
6302
6208
|
// this.hostedContainer?.dispose();
|
|
6303
6209
|
(_b = this.actionsPart) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
@@ -6310,6 +6216,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6310
6216
|
this.component = component;
|
|
6311
6217
|
this.reactPortalStore = reactPortalStore;
|
|
6312
6218
|
this._element = document.createElement('div');
|
|
6219
|
+
this._element.className = 'dockview-react-part';
|
|
6313
6220
|
}
|
|
6314
6221
|
get element() {
|
|
6315
6222
|
return this._element;
|
|
@@ -6354,7 +6261,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6354
6261
|
const panelId = panelData.id;
|
|
6355
6262
|
const params = panelData.params;
|
|
6356
6263
|
const title = panelData.title;
|
|
6357
|
-
const state = panelData.state;
|
|
6358
6264
|
const suppressClosable = panelData.suppressClosable;
|
|
6359
6265
|
const viewData = panelData.view;
|
|
6360
6266
|
const view = new DefaultGroupPanelView({
|
|
@@ -6363,13 +6269,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6363
6269
|
? 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)
|
|
6364
6270
|
: new DefaultTab(),
|
|
6365
6271
|
});
|
|
6366
|
-
const panel = new DockviewGroupPanel(panelId, new DockviewApi(this.layout));
|
|
6272
|
+
const panel = new DockviewGroupPanel(panelId, this.layout, new DockviewApi(this.layout));
|
|
6367
6273
|
panel.init({
|
|
6368
6274
|
view,
|
|
6369
6275
|
title,
|
|
6370
6276
|
suppressClosable,
|
|
6371
6277
|
params: params || {},
|
|
6372
|
-
state: state || {},
|
|
6373
6278
|
});
|
|
6374
6279
|
return panel;
|
|
6375
6280
|
}
|
|
@@ -6384,8 +6289,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6384
6289
|
value: undefined,
|
|
6385
6290
|
};
|
|
6386
6291
|
this._element = document.createElement('div');
|
|
6387
|
-
this._element.
|
|
6388
|
-
this._element.style.width = '100%';
|
|
6292
|
+
this._element.className = 'dockview-react-part';
|
|
6389
6293
|
}
|
|
6390
6294
|
get element() {
|
|
6391
6295
|
return this._element;
|
|
@@ -6483,12 +6387,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6483
6387
|
frameworkTabComponents: props.tabComponents,
|
|
6484
6388
|
tabHeight: props.tabHeight,
|
|
6485
6389
|
debug: props.debug,
|
|
6486
|
-
enableExternalDragEvents: props.enableExternalDragEvents,
|
|
6487
6390
|
watermarkFrameworkComponent: props.watermarkComponent,
|
|
6488
6391
|
styles: props.hideBorders
|
|
6489
6392
|
? { separatorBorder: 'transparent' }
|
|
6490
6393
|
: undefined,
|
|
6491
6394
|
});
|
|
6395
|
+
const disposable = dockview.onDidDrop((event) => {
|
|
6396
|
+
if (props.onDidDrop) {
|
|
6397
|
+
props.onDidDrop(event);
|
|
6398
|
+
}
|
|
6399
|
+
});
|
|
6492
6400
|
(_a = domRef.current) === null || _a === void 0 ? void 0 : _a.appendChild(dockview.element);
|
|
6493
6401
|
dockview.deserializer = new ReactPanelDeserialzier(dockview);
|
|
6494
6402
|
const { clientWidth, clientHeight } = domRef.current;
|
|
@@ -6498,6 +6406,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6498
6406
|
}
|
|
6499
6407
|
dockviewRef.current = dockview;
|
|
6500
6408
|
return () => {
|
|
6409
|
+
disposable.dispose();
|
|
6501
6410
|
dockview.dispose();
|
|
6502
6411
|
};
|
|
6503
6412
|
}, []);
|
|
@@ -6509,6 +6418,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6509
6418
|
frameworkComponents: props.components,
|
|
6510
6419
|
});
|
|
6511
6420
|
}, [props.components]);
|
|
6421
|
+
React__namespace.useEffect(() => {
|
|
6422
|
+
if (!dockviewRef.current) {
|
|
6423
|
+
return;
|
|
6424
|
+
}
|
|
6425
|
+
dockviewRef.current.updateOptions({
|
|
6426
|
+
showDndOverlay: props.showDndOverlay,
|
|
6427
|
+
});
|
|
6428
|
+
}, [props.showDndOverlay]);
|
|
6512
6429
|
React__namespace.useEffect(() => {
|
|
6513
6430
|
if (!dockviewRef.current) {
|
|
6514
6431
|
return;
|
|
@@ -6597,9 +6514,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6597
6514
|
getComponent() {
|
|
6598
6515
|
var _a;
|
|
6599
6516
|
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
6600
|
-
params: ((_a = this.
|
|
6517
|
+
params: ((_a = this._params) === null || _a === void 0 ? void 0 : _a.params) || {},
|
|
6601
6518
|
api: this.api,
|
|
6602
|
-
containerApi: this.
|
|
6519
|
+
containerApi: this._params
|
|
6603
6520
|
.containerApi,
|
|
6604
6521
|
});
|
|
6605
6522
|
}
|
|
@@ -6672,9 +6589,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6672
6589
|
getComponent() {
|
|
6673
6590
|
var _a;
|
|
6674
6591
|
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
6675
|
-
params: ((_a = this.
|
|
6592
|
+
params: ((_a = this._params) === null || _a === void 0 ? void 0 : _a.params) || {},
|
|
6676
6593
|
api: this.api,
|
|
6677
|
-
containerApi: this.
|
|
6594
|
+
containerApi: this._params
|
|
6678
6595
|
.containerApi,
|
|
6679
6596
|
});
|
|
6680
6597
|
}
|
|
@@ -6865,7 +6782,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6865
6782
|
exports.BaseGrid = BaseGrid;
|
|
6866
6783
|
exports.CompositeDisposable = CompositeDisposable;
|
|
6867
6784
|
exports.ContentContainer = ContentContainer;
|
|
6868
|
-
exports.DATA_KEY = DATA_KEY;
|
|
6869
6785
|
exports.DockviewApi = DockviewApi;
|
|
6870
6786
|
exports.DockviewComponent = DockviewComponent;
|
|
6871
6787
|
exports.DockviewComponents = DockviewComponents;
|
|
@@ -6897,9 +6813,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6897
6813
|
exports.SplitviewPanel = SplitviewPanel;
|
|
6898
6814
|
exports.SplitviewReact = SplitviewReact;
|
|
6899
6815
|
exports.Tab = Tab$1;
|
|
6816
|
+
exports.TickDelayedEvent = TickDelayedEvent;
|
|
6900
6817
|
exports.addDisposableListener = addDisposableListener;
|
|
6901
6818
|
exports.addDisposableWindowListener = addDisposableWindowListener;
|
|
6902
|
-
exports.extractData = extractData;
|
|
6903
6819
|
exports.getDirectionOrientation = getDirectionOrientation;
|
|
6904
6820
|
exports.getGridLocation = getGridLocation;
|
|
6905
6821
|
exports.getLocationOrientation = getLocationOrientation;
|
|
@@ -6907,11 +6823,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6907
6823
|
exports.getPanelData = getPanelData;
|
|
6908
6824
|
exports.getRelativeLocation = getRelativeLocation;
|
|
6909
6825
|
exports.indexInParent = indexInParent;
|
|
6910
|
-
exports.isCustomDragEvent = isCustomDragEvent;
|
|
6911
6826
|
exports.isGridBranchNode = isGridBranchNode;
|
|
6912
|
-
exports.isPanelTransferEvent = isPanelTransferEvent;
|
|
6913
6827
|
exports.isReactElement = isReactElement;
|
|
6914
|
-
exports.isTabDragEvent = isTabDragEvent;
|
|
6915
6828
|
exports.orthogonal = orthogonal;
|
|
6916
6829
|
exports.toTarget = toTarget;
|
|
6917
6830
|
exports.usePortalsLifecycle = usePortalsLifecycle;
|