dockview-core 1.7.2 → 1.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/dockviewPanelApi.d.ts +2 -2
- package/dist/cjs/api/dockviewPanelApi.d.ts.map +1 -1
- package/dist/cjs/api/dockviewPanelApi.js +1 -1
- package/dist/cjs/api/dockviewPanelApi.js.map +1 -1
- package/dist/cjs/api/panelApi.d.ts.map +1 -1
- package/dist/cjs/api/panelApi.js +3 -5
- package/dist/cjs/api/panelApi.js.map +1 -1
- package/dist/cjs/dnd/abstractDragHandler.d.ts.map +1 -1
- package/dist/cjs/dnd/abstractDragHandler.js +1 -0
- package/dist/cjs/dnd/abstractDragHandler.js.map +1 -1
- package/dist/cjs/dnd/droptarget.d.ts.map +1 -1
- package/dist/cjs/dnd/droptarget.js +1 -0
- package/dist/cjs/dnd/droptarget.js.map +1 -1
- package/dist/cjs/dnd/groupDragHandler.d.ts +0 -1
- package/dist/cjs/dnd/groupDragHandler.d.ts.map +1 -1
- package/dist/cjs/dnd/groupDragHandler.js +0 -3
- package/dist/cjs/dnd/groupDragHandler.js.map +1 -1
- package/dist/cjs/dockview/components/panel/content.d.ts.map +1 -1
- package/dist/cjs/dockview/components/panel/content.js +2 -2
- package/dist/cjs/dockview/components/panel/content.js.map +1 -1
- package/dist/cjs/dockview/components/tab/tab.d.ts +2 -2
- package/dist/cjs/dockview/components/tab/tab.d.ts.map +1 -1
- package/dist/cjs/dockview/components/tab/tab.js +2 -7
- package/dist/cjs/dockview/components/tab/tab.js.map +1 -1
- package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts.map +1 -1
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +27 -3
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.js +23 -21
- package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +2 -2
- package/dist/cjs/dockview/dockviewGroupPanelModel.js.map +1 -1
- package/dist/cjs/dockview/dockviewPanel.d.ts +7 -6
- package/dist/cjs/dockview/dockviewPanel.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewPanel.js +37 -12
- package/dist/cjs/dockview/dockviewPanel.js.map +1 -1
- package/dist/cjs/dockview/dockviewPanelModel.d.ts +4 -3
- package/dist/cjs/dockview/dockviewPanelModel.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewPanelModel.js.map +1 -1
- package/dist/cjs/dockview/types.d.ts +1 -5
- package/dist/cjs/dockview/types.d.ts.map +1 -1
- package/dist/cjs/dockview/types.js.map +1 -1
- package/dist/cjs/dom.js +1 -5
- package/dist/cjs/dom.js.map +1 -1
- package/dist/cjs/events.d.ts +17 -0
- package/dist/cjs/events.d.ts.map +1 -1
- package/dist/cjs/events.js +94 -7
- package/dist/cjs/events.js.map +1 -1
- package/dist/cjs/gridview/baseComponentGridview.d.ts.map +1 -1
- package/dist/cjs/gridview/baseComponentGridview.js +2 -3
- package/dist/cjs/gridview/baseComponentGridview.js.map +1 -1
- package/dist/cjs/gridview/basePanelView.d.ts.map +1 -1
- package/dist/cjs/gridview/basePanelView.js +41 -8
- package/dist/cjs/gridview/basePanelView.js.map +1 -1
- package/dist/cjs/gridview/branchNode.d.ts +1 -1
- package/dist/cjs/gridview/branchNode.d.ts.map +1 -1
- package/dist/cjs/gridview/branchNode.js +3 -3
- package/dist/cjs/gridview/branchNode.js.map +1 -1
- package/dist/cjs/gridview/gridview.d.ts.map +1 -1
- package/dist/cjs/gridview/gridview.js +21 -13
- package/dist/cjs/gridview/gridview.js.map +1 -1
- package/dist/cjs/gridview/gridviewPanel.js +2 -2
- package/dist/cjs/gridview/gridviewPanel.js.map +1 -1
- package/dist/cjs/lifecycle.d.ts +1 -1
- package/dist/cjs/lifecycle.d.ts.map +1 -1
- package/dist/cjs/lifecycle.js +3 -3
- package/dist/cjs/lifecycle.js.map +1 -1
- package/dist/cjs/splitview/splitview.d.ts +3 -2
- package/dist/cjs/splitview/splitview.d.ts.map +1 -1
- package/dist/cjs/splitview/splitview.js +103 -84
- package/dist/cjs/splitview/splitview.js.map +1 -1
- package/dist/cjs/splitview/splitviewComponent.d.ts +2 -2
- package/dist/cjs/splitview/splitviewComponent.d.ts.map +1 -1
- package/dist/cjs/splitview/splitviewComponent.js +36 -20
- package/dist/cjs/splitview/splitviewComponent.js.map +1 -1
- package/dist/cjs/splitview/splitviewPanel.d.ts.map +1 -1
- package/dist/cjs/splitview/splitviewPanel.js.map +1 -1
- package/dist/dockview-core.amd.js +284 -196
- package/dist/dockview-core.amd.min.js +2 -2
- package/dist/dockview-core.amd.min.noStyle.js +2 -2
- package/dist/dockview-core.amd.noStyle.js +284 -196
- package/dist/dockview-core.cjs.js +284 -196
- package/dist/dockview-core.esm.js +284 -196
- package/dist/dockview-core.esm.min.js +2 -2
- package/dist/dockview-core.js +284 -196
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.noStyle.js +284 -196
- package/dist/esm/api/dockviewPanelApi.d.ts +2 -2
- package/dist/esm/api/dockviewPanelApi.d.ts.map +1 -1
- package/dist/esm/api/dockviewPanelApi.js +1 -1
- package/dist/esm/api/dockviewPanelApi.js.map +1 -1
- package/dist/esm/api/panelApi.d.ts.map +1 -1
- package/dist/esm/api/panelApi.js +3 -5
- package/dist/esm/api/panelApi.js.map +1 -1
- package/dist/esm/dnd/abstractDragHandler.d.ts.map +1 -1
- package/dist/esm/dnd/abstractDragHandler.js +1 -0
- package/dist/esm/dnd/abstractDragHandler.js.map +1 -1
- package/dist/esm/dnd/droptarget.d.ts.map +1 -1
- package/dist/esm/dnd/droptarget.js +1 -0
- package/dist/esm/dnd/droptarget.js.map +1 -1
- package/dist/esm/dnd/groupDragHandler.d.ts +0 -1
- package/dist/esm/dnd/groupDragHandler.d.ts.map +1 -1
- package/dist/esm/dnd/groupDragHandler.js +0 -3
- package/dist/esm/dnd/groupDragHandler.js.map +1 -1
- package/dist/esm/dockview/components/panel/content.d.ts.map +1 -1
- package/dist/esm/dockview/components/panel/content.js +2 -2
- package/dist/esm/dockview/components/panel/content.js.map +1 -1
- package/dist/esm/dockview/components/tab/tab.d.ts +2 -2
- package/dist/esm/dockview/components/tab/tab.d.ts.map +1 -1
- package/dist/esm/dockview/components/tab/tab.js +2 -7
- package/dist/esm/dockview/components/tab/tab.js.map +1 -1
- package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts.map +1 -1
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +5 -3
- package/dist/esm/dockview/components/titlebar/tabsContainer.js.map +1 -1
- package/dist/esm/dockview/dockviewComponent.d.ts +1 -1
- package/dist/esm/dockview/dockviewComponent.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewComponent.js +23 -21
- package/dist/esm/dockview/dockviewComponent.js.map +1 -1
- package/dist/esm/dockview/dockviewGroupPanelModel.js +2 -2
- package/dist/esm/dockview/dockviewGroupPanelModel.js.map +1 -1
- package/dist/esm/dockview/dockviewPanel.d.ts +7 -6
- package/dist/esm/dockview/dockviewPanel.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewPanel.js +15 -12
- package/dist/esm/dockview/dockviewPanel.js.map +1 -1
- package/dist/esm/dockview/dockviewPanelModel.d.ts +4 -3
- package/dist/esm/dockview/dockviewPanelModel.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewPanelModel.js.map +1 -1
- package/dist/esm/dockview/types.d.ts +1 -5
- package/dist/esm/dockview/types.d.ts.map +1 -1
- package/dist/esm/dockview/types.js.map +1 -1
- package/dist/esm/dom.js +1 -5
- package/dist/esm/dom.js.map +1 -1
- package/dist/esm/events.d.ts +17 -0
- package/dist/esm/events.d.ts.map +1 -1
- package/dist/esm/events.js +75 -7
- package/dist/esm/events.js.map +1 -1
- package/dist/esm/gridview/baseComponentGridview.d.ts.map +1 -1
- package/dist/esm/gridview/baseComponentGridview.js +2 -3
- package/dist/esm/gridview/baseComponentGridview.js.map +1 -1
- package/dist/esm/gridview/basePanelView.d.ts.map +1 -1
- package/dist/esm/gridview/basePanelView.js +16 -5
- package/dist/esm/gridview/basePanelView.js.map +1 -1
- package/dist/esm/gridview/branchNode.d.ts +1 -1
- package/dist/esm/gridview/branchNode.d.ts.map +1 -1
- package/dist/esm/gridview/branchNode.js +3 -3
- package/dist/esm/gridview/branchNode.js.map +1 -1
- package/dist/esm/gridview/gridview.d.ts.map +1 -1
- package/dist/esm/gridview/gridview.js +19 -11
- package/dist/esm/gridview/gridview.js.map +1 -1
- package/dist/esm/gridview/gridviewPanel.js +2 -2
- package/dist/esm/gridview/gridviewPanel.js.map +1 -1
- package/dist/esm/lifecycle.d.ts +1 -1
- package/dist/esm/lifecycle.d.ts.map +1 -1
- package/dist/esm/lifecycle.js +3 -3
- package/dist/esm/lifecycle.js.map +1 -1
- package/dist/esm/splitview/splitview.d.ts +3 -2
- package/dist/esm/splitview/splitview.d.ts.map +1 -1
- package/dist/esm/splitview/splitview.js +90 -84
- package/dist/esm/splitview/splitview.js.map +1 -1
- package/dist/esm/splitview/splitviewComponent.d.ts +2 -2
- package/dist/esm/splitview/splitviewComponent.d.ts.map +1 -1
- package/dist/esm/splitview/splitviewComponent.js +22 -16
- package/dist/esm/splitview/splitviewComponent.js.map +1 -1
- package/dist/esm/splitview/splitviewPanel.d.ts.map +1 -1
- package/dist/esm/splitview/splitviewPanel.js.map +1 -1
- package/package.json +2 -2
package/dist/dockview-core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 1.7.
|
|
3
|
+
* @version 1.7.4
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -125,9 +125,49 @@
|
|
|
125
125
|
};
|
|
126
126
|
};
|
|
127
127
|
})(exports.DockviewEvent || (exports.DockviewEvent = {}));
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
class LeakageMonitor {
|
|
129
|
+
constructor() {
|
|
130
|
+
this.events = new Map();
|
|
131
|
+
}
|
|
132
|
+
get size() {
|
|
133
|
+
return this.events.size;
|
|
134
|
+
}
|
|
135
|
+
add(event, stacktrace) {
|
|
136
|
+
this.events.set(event, stacktrace);
|
|
137
|
+
}
|
|
138
|
+
delete(event) {
|
|
139
|
+
this.events.delete(event);
|
|
140
|
+
}
|
|
141
|
+
clear() {
|
|
142
|
+
this.events.clear();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
class Stacktrace {
|
|
146
|
+
static create() {
|
|
147
|
+
var _a;
|
|
148
|
+
return new Stacktrace((_a = new Error().stack) !== null && _a !== void 0 ? _a : '');
|
|
149
|
+
}
|
|
150
|
+
constructor(value) {
|
|
151
|
+
this.value = value;
|
|
152
|
+
}
|
|
153
|
+
print() {
|
|
154
|
+
console.warn(this.value);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
class Listener {
|
|
158
|
+
constructor(callback, stacktrace) {
|
|
159
|
+
this.callback = callback;
|
|
160
|
+
this.stacktrace = stacktrace;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// relatively simple event emitter taken from https://github.com/microsoft/vscode/blob/master/src/vs/base/common/event.ts
|
|
130
164
|
class Emitter {
|
|
165
|
+
static setLeakageMonitorEnabled(isEnabled) {
|
|
166
|
+
if (isEnabled !== Emitter.ENABLE_TRACKING) {
|
|
167
|
+
Emitter.MEMORY_LEAK_WATCHER.clear();
|
|
168
|
+
}
|
|
169
|
+
Emitter.ENABLE_TRACKING = isEnabled;
|
|
170
|
+
}
|
|
131
171
|
constructor(options) {
|
|
132
172
|
this.options = options;
|
|
133
173
|
this._listeners = [];
|
|
@@ -135,11 +175,12 @@
|
|
|
135
175
|
}
|
|
136
176
|
get event() {
|
|
137
177
|
if (!this._event) {
|
|
138
|
-
this._event = (
|
|
178
|
+
this._event = (callback) => {
|
|
139
179
|
var _a;
|
|
140
180
|
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) && this._last !== undefined) {
|
|
141
|
-
|
|
181
|
+
callback(this._last);
|
|
142
182
|
}
|
|
183
|
+
const listener = new Listener(callback, Emitter.ENABLE_TRACKING ? Stacktrace.create() : undefined);
|
|
143
184
|
this._listeners.push(listener);
|
|
144
185
|
return {
|
|
145
186
|
dispose: () => {
|
|
@@ -147,23 +188,45 @@
|
|
|
147
188
|
if (index > -1) {
|
|
148
189
|
this._listeners.splice(index, 1);
|
|
149
190
|
}
|
|
191
|
+
else if (Emitter.ENABLE_TRACKING) ;
|
|
150
192
|
},
|
|
151
193
|
};
|
|
152
194
|
};
|
|
195
|
+
if (Emitter.ENABLE_TRACKING) {
|
|
196
|
+
Emitter.MEMORY_LEAK_WATCHER.add(this._event, Stacktrace.create());
|
|
197
|
+
}
|
|
153
198
|
}
|
|
154
199
|
return this._event;
|
|
155
200
|
}
|
|
156
201
|
fire(e) {
|
|
157
202
|
this._last = e;
|
|
158
203
|
for (const listener of this._listeners) {
|
|
159
|
-
listener(e);
|
|
204
|
+
listener.callback(e);
|
|
160
205
|
}
|
|
161
206
|
}
|
|
162
207
|
dispose() {
|
|
163
|
-
this.
|
|
164
|
-
|
|
208
|
+
if (!this._disposed) {
|
|
209
|
+
this._disposed = true;
|
|
210
|
+
if (this._listeners.length > 0) {
|
|
211
|
+
if (Emitter.ENABLE_TRACKING) {
|
|
212
|
+
queueMicrotask(() => {
|
|
213
|
+
var _a;
|
|
214
|
+
// don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block
|
|
215
|
+
for (const listener of this._listeners) {
|
|
216
|
+
console.warn((_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
this._listeners = [];
|
|
221
|
+
}
|
|
222
|
+
if (Emitter.ENABLE_TRACKING && this._event) {
|
|
223
|
+
Emitter.MEMORY_LEAK_WATCHER.delete(this._event);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
165
226
|
}
|
|
166
227
|
}
|
|
228
|
+
Emitter.ENABLE_TRACKING = false;
|
|
229
|
+
Emitter.MEMORY_LEAK_WATCHER = new LeakageMonitor();
|
|
167
230
|
function addDisposableWindowListener(element, type, listener, options) {
|
|
168
231
|
element.addEventListener(type, listener, options);
|
|
169
232
|
return {
|
|
@@ -216,13 +279,13 @@
|
|
|
216
279
|
}
|
|
217
280
|
constructor(...args) {
|
|
218
281
|
this._isDisposed = false;
|
|
219
|
-
this.
|
|
282
|
+
this._disposables = args;
|
|
220
283
|
}
|
|
221
284
|
addDisposables(...args) {
|
|
222
|
-
args.forEach((arg) => this.
|
|
285
|
+
args.forEach((arg) => this._disposables.push(arg));
|
|
223
286
|
}
|
|
224
287
|
dispose() {
|
|
225
|
-
this.
|
|
288
|
+
this._disposables.forEach((arg) => arg.dispose());
|
|
226
289
|
this._isDisposed = true;
|
|
227
290
|
}
|
|
228
291
|
}
|
|
@@ -312,6 +375,7 @@
|
|
|
312
375
|
this.onDidFocus = this._onDidFocus.event;
|
|
313
376
|
this._onDidBlur = new Emitter();
|
|
314
377
|
this.onDidBlur = this._onDidBlur.event;
|
|
378
|
+
this.addDisposables(this._onDidFocus, this._onDidBlur);
|
|
315
379
|
let hasFocus = isAncestor(document.activeElement, element);
|
|
316
380
|
let loosingFocus = false;
|
|
317
381
|
const onFocus = () => {
|
|
@@ -356,11 +420,6 @@
|
|
|
356
420
|
refreshState() {
|
|
357
421
|
this._refreshStateHandler();
|
|
358
422
|
}
|
|
359
|
-
dispose() {
|
|
360
|
-
super.dispose();
|
|
361
|
-
this._onDidBlur.dispose();
|
|
362
|
-
this._onDidFocus.dispose();
|
|
363
|
-
}
|
|
364
423
|
}
|
|
365
424
|
|
|
366
425
|
function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
|
|
@@ -589,7 +648,7 @@
|
|
|
589
648
|
this._orthogonalSize = value;
|
|
590
649
|
}
|
|
591
650
|
get length() {
|
|
592
|
-
return this.
|
|
651
|
+
return this.viewItems.length;
|
|
593
652
|
}
|
|
594
653
|
get proportions() {
|
|
595
654
|
return this._proportions ? [...this._proportions] : undefined;
|
|
@@ -608,12 +667,12 @@
|
|
|
608
667
|
: 'vertical');
|
|
609
668
|
}
|
|
610
669
|
get minimumSize() {
|
|
611
|
-
return this.
|
|
670
|
+
return this.viewItems.reduce((r, item) => r + item.minimumSize, 0);
|
|
612
671
|
}
|
|
613
672
|
get maximumSize() {
|
|
614
673
|
return this.length === 0
|
|
615
674
|
? Number.POSITIVE_INFINITY
|
|
616
|
-
: this.
|
|
675
|
+
: this.viewItems.reduce((r, item) => r + item.maximumSize, 0);
|
|
617
676
|
}
|
|
618
677
|
get startSnappingEnabled() {
|
|
619
678
|
return this._startSnappingEnabled;
|
|
@@ -637,7 +696,7 @@
|
|
|
637
696
|
}
|
|
638
697
|
constructor(container, options) {
|
|
639
698
|
this.container = container;
|
|
640
|
-
this.
|
|
699
|
+
this.viewItems = [];
|
|
641
700
|
this.sashes = [];
|
|
642
701
|
this._size = 0;
|
|
643
702
|
this._orthogonalSize = 0;
|
|
@@ -651,12 +710,12 @@
|
|
|
651
710
|
this.onDidAddView = this._onDidAddView.event;
|
|
652
711
|
this._onDidRemoveView = new Emitter();
|
|
653
712
|
this.onDidRemoveView = this._onDidRemoveView.event;
|
|
654
|
-
this.resize = (index, delta, sizes = this.
|
|
655
|
-
if (index < 0 || index > this.
|
|
713
|
+
this.resize = (index, delta, sizes = this.viewItems.map((x) => x.size), lowPriorityIndexes, highPriorityIndexes, overloadMinDelta = Number.NEGATIVE_INFINITY, overloadMaxDelta = Number.POSITIVE_INFINITY, snapBefore, snapAfter) => {
|
|
714
|
+
if (index < 0 || index > this.viewItems.length) {
|
|
656
715
|
return 0;
|
|
657
716
|
}
|
|
658
717
|
const upIndexes = range(index, -1);
|
|
659
|
-
const downIndexes = range(index + 1, this.
|
|
718
|
+
const downIndexes = range(index + 1, this.viewItems.length);
|
|
660
719
|
//
|
|
661
720
|
if (highPriorityIndexes) {
|
|
662
721
|
for (const i of highPriorityIndexes) {
|
|
@@ -671,34 +730,34 @@
|
|
|
671
730
|
}
|
|
672
731
|
}
|
|
673
732
|
//
|
|
674
|
-
const upItems = upIndexes.map((i) => this.
|
|
733
|
+
const upItems = upIndexes.map((i) => this.viewItems[i]);
|
|
675
734
|
const upSizes = upIndexes.map((i) => sizes[i]);
|
|
676
735
|
//
|
|
677
|
-
const downItems = downIndexes.map((i) => this.
|
|
736
|
+
const downItems = downIndexes.map((i) => this.viewItems[i]);
|
|
678
737
|
const downSizes = downIndexes.map((i) => sizes[i]);
|
|
679
738
|
//
|
|
680
|
-
const minDeltaUp = upIndexes.reduce((_, i) => _ + this.
|
|
681
|
-
const maxDeltaUp = upIndexes.reduce((_, i) => _ + this.
|
|
739
|
+
const minDeltaUp = upIndexes.reduce((_, i) => _ + this.viewItems[i].minimumSize - sizes[i], 0);
|
|
740
|
+
const maxDeltaUp = upIndexes.reduce((_, i) => _ + this.viewItems[i].maximumSize - sizes[i], 0);
|
|
682
741
|
//
|
|
683
742
|
const maxDeltaDown = downIndexes.length === 0
|
|
684
743
|
? Number.POSITIVE_INFINITY
|
|
685
|
-
: downIndexes.reduce((_, i) => _ + sizes[i] - this.
|
|
744
|
+
: downIndexes.reduce((_, i) => _ + sizes[i] - this.viewItems[i].minimumSize, 0);
|
|
686
745
|
const minDeltaDown = downIndexes.length === 0
|
|
687
746
|
? Number.NEGATIVE_INFINITY
|
|
688
|
-
: downIndexes.reduce((_, i) => _ + sizes[i] - this.
|
|
747
|
+
: downIndexes.reduce((_, i) => _ + sizes[i] - this.viewItems[i].maximumSize, 0);
|
|
689
748
|
//
|
|
690
749
|
const minDelta = Math.max(minDeltaUp, minDeltaDown);
|
|
691
750
|
const maxDelta = Math.min(maxDeltaDown, maxDeltaUp);
|
|
692
751
|
//
|
|
693
752
|
let snapped = false;
|
|
694
753
|
if (snapBefore) {
|
|
695
|
-
const snapView = this.
|
|
754
|
+
const snapView = this.viewItems[snapBefore.index];
|
|
696
755
|
const visible = delta >= snapBefore.limitDelta;
|
|
697
756
|
snapped = visible !== snapView.visible;
|
|
698
757
|
snapView.setVisible(visible, snapBefore.size);
|
|
699
758
|
}
|
|
700
759
|
if (!snapped && snapAfter) {
|
|
701
|
-
const snapView = this.
|
|
760
|
+
const snapView = this.viewItems[snapAfter.index];
|
|
702
761
|
const visible = delta < snapAfter.limitDelta;
|
|
703
762
|
snapped = visible !== snapView.visible;
|
|
704
763
|
snapView.setVisible(visible, snapAfter.size);
|
|
@@ -760,7 +819,7 @@
|
|
|
760
819
|
);
|
|
761
820
|
});
|
|
762
821
|
// Initialize content size and proportions for first layout
|
|
763
|
-
this.contentSize = this.
|
|
822
|
+
this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
764
823
|
this.saveProportions();
|
|
765
824
|
}
|
|
766
825
|
}
|
|
@@ -777,18 +836,18 @@
|
|
|
777
836
|
}
|
|
778
837
|
}
|
|
779
838
|
isViewVisible(index) {
|
|
780
|
-
if (index < 0 || index >= this.
|
|
839
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
781
840
|
throw new Error('Index out of bounds');
|
|
782
841
|
}
|
|
783
|
-
const viewItem = this.
|
|
842
|
+
const viewItem = this.viewItems[index];
|
|
784
843
|
return viewItem.visible;
|
|
785
844
|
}
|
|
786
845
|
setViewVisible(index, visible) {
|
|
787
|
-
if (index < 0 || index >= this.
|
|
846
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
788
847
|
throw new Error('Index out of bounds');
|
|
789
848
|
}
|
|
790
849
|
toggleClass(this.container, 'visible', visible);
|
|
791
|
-
const viewItem = this.
|
|
850
|
+
const viewItem = this.viewItems[index];
|
|
792
851
|
toggleClass(this.container, 'visible', visible);
|
|
793
852
|
viewItem.setVisible(visible, viewItem.size);
|
|
794
853
|
this.distributeEmptySpace(index);
|
|
@@ -796,33 +855,33 @@
|
|
|
796
855
|
this.saveProportions();
|
|
797
856
|
}
|
|
798
857
|
getViewSize(index) {
|
|
799
|
-
if (index < 0 || index >= this.
|
|
858
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
800
859
|
return -1;
|
|
801
860
|
}
|
|
802
|
-
return this.
|
|
861
|
+
return this.viewItems[index].size;
|
|
803
862
|
}
|
|
804
863
|
resizeView(index, size) {
|
|
805
|
-
if (index < 0 || index >= this.
|
|
864
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
806
865
|
return;
|
|
807
866
|
}
|
|
808
|
-
const indexes = range(this.
|
|
867
|
+
const indexes = range(this.viewItems.length).filter((i) => i !== index);
|
|
809
868
|
const lowPriorityIndexes = [
|
|
810
|
-
...indexes.filter((i) => this.
|
|
869
|
+
...indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low),
|
|
811
870
|
index,
|
|
812
871
|
];
|
|
813
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
814
|
-
const item = this.
|
|
872
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
873
|
+
const item = this.viewItems[index];
|
|
815
874
|
size = Math.round(size);
|
|
816
875
|
size = clamp(size, item.minimumSize, Math.min(item.maximumSize, this._size));
|
|
817
876
|
item.size = size;
|
|
818
877
|
this.relayout(lowPriorityIndexes, highPriorityIndexes);
|
|
819
878
|
}
|
|
820
879
|
getViews() {
|
|
821
|
-
return this.
|
|
880
|
+
return this.viewItems.map((x) => x.view);
|
|
822
881
|
}
|
|
823
882
|
onDidChange(item, size) {
|
|
824
|
-
const index = this.
|
|
825
|
-
if (index < 0 || index >= this.
|
|
883
|
+
const index = this.viewItems.indexOf(item);
|
|
884
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
826
885
|
return;
|
|
827
886
|
}
|
|
828
887
|
size = typeof size === 'number' ? size : item.size;
|
|
@@ -830,7 +889,7 @@
|
|
|
830
889
|
item.size = size;
|
|
831
890
|
this.relayout([index]);
|
|
832
891
|
}
|
|
833
|
-
addView(view, size = { type: 'distribute' }, index = this.
|
|
892
|
+
addView(view, size = { type: 'distribute' }, index = this.viewItems.length, skipLayout) {
|
|
834
893
|
const container = document.createElement('div');
|
|
835
894
|
container.className = 'view';
|
|
836
895
|
container.appendChild(view.element);
|
|
@@ -848,24 +907,25 @@
|
|
|
848
907
|
viewSize = view.minimumSize;
|
|
849
908
|
}
|
|
850
909
|
const disposable = view.onDidChange((newSize) => this.onDidChange(viewItem, newSize.size));
|
|
851
|
-
const
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
910
|
+
const viewItem = new ViewItem(container, view, viewSize, {
|
|
911
|
+
dispose: () => {
|
|
912
|
+
disposable.dispose();
|
|
913
|
+
this.viewContainer.removeChild(container);
|
|
914
|
+
},
|
|
915
|
+
});
|
|
916
|
+
if (index === this.viewItems.length) {
|
|
857
917
|
this.viewContainer.appendChild(container);
|
|
858
918
|
}
|
|
859
919
|
else {
|
|
860
920
|
this.viewContainer.insertBefore(container, this.viewContainer.children.item(index));
|
|
861
921
|
}
|
|
862
|
-
this.
|
|
863
|
-
if (this.
|
|
922
|
+
this.viewItems.splice(index, 0, viewItem);
|
|
923
|
+
if (this.viewItems.length > 1) {
|
|
864
924
|
//add sash
|
|
865
925
|
const sash = document.createElement('div');
|
|
866
926
|
sash.className = 'sash';
|
|
867
927
|
const onStart = (event) => {
|
|
868
|
-
for (const item of this.
|
|
928
|
+
for (const item of this.viewItems) {
|
|
869
929
|
item.enabled = false;
|
|
870
930
|
}
|
|
871
931
|
const iframes = [
|
|
@@ -880,27 +940,29 @@
|
|
|
880
940
|
: event.clientY;
|
|
881
941
|
const sashIndex = firstIndex(this.sashes, (s) => s.container === sash);
|
|
882
942
|
//
|
|
883
|
-
const sizes = this.
|
|
943
|
+
const sizes = this.viewItems.map((x) => x.size);
|
|
884
944
|
//
|
|
885
945
|
let snapBefore;
|
|
886
946
|
let snapAfter;
|
|
887
947
|
const upIndexes = range(sashIndex, -1);
|
|
888
|
-
const downIndexes = range(sashIndex + 1, this.
|
|
889
|
-
const minDeltaUp = upIndexes.reduce((r, i) => r + (this.
|
|
890
|
-
const maxDeltaUp = upIndexes.reduce((r, i) => r + (this.
|
|
948
|
+
const downIndexes = range(sashIndex + 1, this.viewItems.length);
|
|
949
|
+
const minDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].minimumSize - sizes[i]), 0);
|
|
950
|
+
const maxDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].viewMaximumSize - sizes[i]), 0);
|
|
891
951
|
const maxDeltaDown = downIndexes.length === 0
|
|
892
952
|
? Number.POSITIVE_INFINITY
|
|
893
|
-
: downIndexes.reduce((r, i) => r +
|
|
953
|
+
: downIndexes.reduce((r, i) => r +
|
|
954
|
+
(sizes[i] - this.viewItems[i].minimumSize), 0);
|
|
894
955
|
const minDeltaDown = downIndexes.length === 0
|
|
895
956
|
? Number.NEGATIVE_INFINITY
|
|
896
957
|
: downIndexes.reduce((r, i) => r +
|
|
897
|
-
(sizes[i] -
|
|
958
|
+
(sizes[i] -
|
|
959
|
+
this.viewItems[i].viewMaximumSize), 0);
|
|
898
960
|
const minDelta = Math.max(minDeltaUp, minDeltaDown);
|
|
899
961
|
const maxDelta = Math.min(maxDeltaDown, maxDeltaUp);
|
|
900
962
|
const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);
|
|
901
963
|
const snapAfterIndex = this.findFirstSnapIndex(downIndexes);
|
|
902
964
|
if (typeof snapBeforeIndex === 'number') {
|
|
903
|
-
const snappedViewItem = this.
|
|
965
|
+
const snappedViewItem = this.viewItems[snapBeforeIndex];
|
|
904
966
|
const halfSize = Math.floor(snappedViewItem.viewMinimumSize / 2);
|
|
905
967
|
snapBefore = {
|
|
906
968
|
index: snapBeforeIndex,
|
|
@@ -911,7 +973,7 @@
|
|
|
911
973
|
};
|
|
912
974
|
}
|
|
913
975
|
if (typeof snapAfterIndex === 'number') {
|
|
914
|
-
const snappedViewItem = this.
|
|
976
|
+
const snappedViewItem = this.viewItems[snapAfterIndex];
|
|
915
977
|
const halfSize = Math.floor(snappedViewItem.viewMinimumSize / 2);
|
|
916
978
|
snapAfter = {
|
|
917
979
|
index: snapAfterIndex,
|
|
@@ -932,7 +994,7 @@
|
|
|
932
994
|
this.layoutViews();
|
|
933
995
|
};
|
|
934
996
|
const end = () => {
|
|
935
|
-
for (const item of this.
|
|
997
|
+
for (const item of this.viewItems) {
|
|
936
998
|
item.enabled = true;
|
|
937
999
|
}
|
|
938
1000
|
for (const iframe of iframes) {
|
|
@@ -972,7 +1034,7 @@
|
|
|
972
1034
|
distributeViewSizes() {
|
|
973
1035
|
const flexibleViewItems = [];
|
|
974
1036
|
let flexibleSize = 0;
|
|
975
|
-
for (const item of this.
|
|
1037
|
+
for (const item of this.viewItems) {
|
|
976
1038
|
if (item.maximumSize - item.minimumSize > 0) {
|
|
977
1039
|
flexibleViewItems.push(item);
|
|
978
1040
|
flexibleSize += item.size;
|
|
@@ -982,17 +1044,17 @@
|
|
|
982
1044
|
for (const item of flexibleViewItems) {
|
|
983
1045
|
item.size = clamp(size, item.minimumSize, item.maximumSize);
|
|
984
1046
|
}
|
|
985
|
-
const indexes = range(this.
|
|
986
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
987
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1047
|
+
const indexes = range(this.viewItems.length);
|
|
1048
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1049
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
988
1050
|
this.relayout(lowPriorityIndexes, highPriorityIndexes);
|
|
989
1051
|
}
|
|
990
1052
|
removeView(index, sizing, skipLayout = false) {
|
|
991
1053
|
// Remove view
|
|
992
|
-
const viewItem = this.
|
|
1054
|
+
const viewItem = this.viewItems.splice(index, 1)[0];
|
|
993
1055
|
viewItem.dispose();
|
|
994
1056
|
// Remove sash
|
|
995
|
-
if (this.
|
|
1057
|
+
if (this.viewItems.length >= 1) {
|
|
996
1058
|
const sashIndex = Math.max(index - 1, 0);
|
|
997
1059
|
const sashItem = this.sashes.splice(sashIndex, 1)[0];
|
|
998
1060
|
sashItem.disposable();
|
|
@@ -1007,10 +1069,10 @@
|
|
|
1007
1069
|
return viewItem.view;
|
|
1008
1070
|
}
|
|
1009
1071
|
getViewCachedVisibleSize(index) {
|
|
1010
|
-
if (index < 0 || index >= this.
|
|
1072
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
1011
1073
|
throw new Error('Index out of bounds');
|
|
1012
1074
|
}
|
|
1013
|
-
const viewItem = this.
|
|
1075
|
+
const viewItem = this.viewItems[index];
|
|
1014
1076
|
return viewItem.cachedVisibleSize;
|
|
1015
1077
|
}
|
|
1016
1078
|
moveView(from, to) {
|
|
@@ -1026,14 +1088,14 @@
|
|
|
1026
1088
|
this.size = size;
|
|
1027
1089
|
this.orthogonalSize = orthogonalSize;
|
|
1028
1090
|
if (!this.proportions) {
|
|
1029
|
-
const indexes = range(this.
|
|
1030
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
1031
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1032
|
-
this.resize(this.
|
|
1091
|
+
const indexes = range(this.viewItems.length);
|
|
1092
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1093
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1094
|
+
this.resize(this.viewItems.length - 1, size - previousSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
1033
1095
|
}
|
|
1034
1096
|
else {
|
|
1035
|
-
for (let i = 0; i < this.
|
|
1036
|
-
const item = this.
|
|
1097
|
+
for (let i = 0; i < this.viewItems.length; i++) {
|
|
1098
|
+
const item = this.viewItems[i];
|
|
1037
1099
|
item.size = clamp(Math.round(this.proportions[i] * size), item.minimumSize, item.maximumSize);
|
|
1038
1100
|
}
|
|
1039
1101
|
}
|
|
@@ -1041,18 +1103,18 @@
|
|
|
1041
1103
|
this.layoutViews();
|
|
1042
1104
|
}
|
|
1043
1105
|
relayout(lowPriorityIndexes, highPriorityIndexes) {
|
|
1044
|
-
const contentSize = this.
|
|
1045
|
-
this.resize(this.
|
|
1106
|
+
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1107
|
+
this.resize(this.viewItems.length - 1, this._size - contentSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
1046
1108
|
this.distributeEmptySpace();
|
|
1047
1109
|
this.layoutViews();
|
|
1048
1110
|
this.saveProportions();
|
|
1049
1111
|
}
|
|
1050
1112
|
distributeEmptySpace(lowPriorityIndex) {
|
|
1051
|
-
const contentSize = this.
|
|
1113
|
+
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1052
1114
|
let emptyDelta = this.size - contentSize;
|
|
1053
|
-
const indexes = range(this.
|
|
1054
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
1055
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1115
|
+
const indexes = range(this.viewItems.length - 1, -1);
|
|
1116
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1117
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1056
1118
|
for (const index of highPriorityIndexes) {
|
|
1057
1119
|
pushToStart(indexes, index);
|
|
1058
1120
|
}
|
|
@@ -1063,7 +1125,7 @@
|
|
|
1063
1125
|
pushToEnd(indexes, lowPriorityIndex);
|
|
1064
1126
|
}
|
|
1065
1127
|
for (let i = 0; emptyDelta !== 0 && i < indexes.length; i++) {
|
|
1066
|
-
const item = this.
|
|
1128
|
+
const item = this.viewItems[indexes[i]];
|
|
1067
1129
|
const size = clamp(item.size + emptyDelta, item.minimumSize, item.maximumSize);
|
|
1068
1130
|
const viewDelta = size - item.size;
|
|
1069
1131
|
emptyDelta -= viewDelta;
|
|
@@ -1072,16 +1134,16 @@
|
|
|
1072
1134
|
}
|
|
1073
1135
|
saveProportions() {
|
|
1074
1136
|
if (this.proportionalLayout && this.contentSize > 0) {
|
|
1075
|
-
this._proportions = this.
|
|
1137
|
+
this._proportions = this.viewItems.map((i) => i.size / this.contentSize);
|
|
1076
1138
|
}
|
|
1077
1139
|
}
|
|
1078
1140
|
layoutViews() {
|
|
1079
|
-
this.contentSize = this.
|
|
1141
|
+
this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1080
1142
|
let sum = 0;
|
|
1081
1143
|
const x = [];
|
|
1082
1144
|
this.updateSashEnablement();
|
|
1083
|
-
for (let i = 0; i < this.
|
|
1084
|
-
sum += this.
|
|
1145
|
+
for (let i = 0; i < this.viewItems.length - 1; i++) {
|
|
1146
|
+
sum += this.viewItems[i].size;
|
|
1085
1147
|
x.push(sum);
|
|
1086
1148
|
const offset = Math.min(Math.max(0, sum - 2), this.size - 4);
|
|
1087
1149
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
@@ -1093,7 +1155,7 @@
|
|
|
1093
1155
|
this.sashes[i].container.style.top = `${offset}px`;
|
|
1094
1156
|
}
|
|
1095
1157
|
}
|
|
1096
|
-
this.
|
|
1158
|
+
this.viewItems.forEach((view, i) => {
|
|
1097
1159
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
1098
1160
|
view.container.style.width = `${view.size}px`;
|
|
1099
1161
|
view.container.style.left = i == 0 ? '0px' : `${x[i - 1]}px`;
|
|
@@ -1112,7 +1174,7 @@
|
|
|
1112
1174
|
findFirstSnapIndex(indexes) {
|
|
1113
1175
|
// visible views first
|
|
1114
1176
|
for (const index of indexes) {
|
|
1115
|
-
const viewItem = this.
|
|
1177
|
+
const viewItem = this.viewItems[index];
|
|
1116
1178
|
if (!viewItem.visible) {
|
|
1117
1179
|
continue;
|
|
1118
1180
|
}
|
|
@@ -1122,7 +1184,7 @@
|
|
|
1122
1184
|
}
|
|
1123
1185
|
// then, hidden views
|
|
1124
1186
|
for (const index of indexes) {
|
|
1125
|
-
const viewItem = this.
|
|
1187
|
+
const viewItem = this.viewItems[index];
|
|
1126
1188
|
if (viewItem.visible &&
|
|
1127
1189
|
viewItem.maximumSize - viewItem.minimumSize > 0) {
|
|
1128
1190
|
return undefined;
|
|
@@ -1135,10 +1197,10 @@
|
|
|
1135
1197
|
}
|
|
1136
1198
|
updateSashEnablement() {
|
|
1137
1199
|
let previous = false;
|
|
1138
|
-
const collapsesDown = this.
|
|
1200
|
+
const collapsesDown = this.viewItems.map((i) => (previous = i.size - i.minimumSize > 0 || previous));
|
|
1139
1201
|
previous = false;
|
|
1140
|
-
const expandsDown = this.
|
|
1141
|
-
const reverseViews = [...this.
|
|
1202
|
+
const expandsDown = this.viewItems.map((i) => (previous = i.maximumSize - i.size > 0 || previous));
|
|
1203
|
+
const reverseViews = [...this.viewItems].reverse();
|
|
1142
1204
|
previous = false;
|
|
1143
1205
|
const collapsesUp = reverseViews
|
|
1144
1206
|
.map((i) => (previous = i.size - i.minimumSize > 0 || previous))
|
|
@@ -1150,19 +1212,19 @@
|
|
|
1150
1212
|
let position = 0;
|
|
1151
1213
|
for (let index = 0; index < this.sashes.length; index++) {
|
|
1152
1214
|
const sash = this.sashes[index];
|
|
1153
|
-
const viewItem = this.
|
|
1215
|
+
const viewItem = this.viewItems[index];
|
|
1154
1216
|
position += viewItem.size;
|
|
1155
1217
|
const min = !(collapsesDown[index] && expandsUp[index + 1]);
|
|
1156
1218
|
const max = !(expandsDown[index] && collapsesUp[index + 1]);
|
|
1157
1219
|
if (min && max) {
|
|
1158
1220
|
const upIndexes = range(index, -1);
|
|
1159
|
-
const downIndexes = range(index + 1, this.
|
|
1221
|
+
const downIndexes = range(index + 1, this.viewItems.length);
|
|
1160
1222
|
const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);
|
|
1161
1223
|
const snapAfterIndex = this.findFirstSnapIndex(downIndexes);
|
|
1162
1224
|
const snappedBefore = typeof snapBeforeIndex === 'number' &&
|
|
1163
|
-
!this.
|
|
1225
|
+
!this.viewItems[snapBeforeIndex].visible;
|
|
1164
1226
|
const snappedAfter = typeof snapAfterIndex === 'number' &&
|
|
1165
|
-
!this.
|
|
1227
|
+
!this.viewItems[snapAfterIndex].visible;
|
|
1166
1228
|
if (snappedBefore &&
|
|
1167
1229
|
collapsesUp[index] &&
|
|
1168
1230
|
(position > 0 || this.startSnappingEnabled)) {
|
|
@@ -1222,6 +1284,9 @@
|
|
|
1222
1284
|
break;
|
|
1223
1285
|
}
|
|
1224
1286
|
}
|
|
1287
|
+
for (const viewItem of this.viewItems) {
|
|
1288
|
+
viewItem.dispose();
|
|
1289
|
+
}
|
|
1225
1290
|
this.element.remove();
|
|
1226
1291
|
}
|
|
1227
1292
|
}
|
|
@@ -1656,7 +1721,7 @@
|
|
|
1656
1721
|
throw new Error('Invalid index');
|
|
1657
1722
|
}
|
|
1658
1723
|
this.splitview.removeView(index, sizing);
|
|
1659
|
-
this._removeChild(index);
|
|
1724
|
+
return this._removeChild(index);
|
|
1660
1725
|
}
|
|
1661
1726
|
_addChild(node, index) {
|
|
1662
1727
|
this.children.splice(index, 0, node);
|
|
@@ -1678,10 +1743,10 @@
|
|
|
1678
1743
|
});
|
|
1679
1744
|
}
|
|
1680
1745
|
dispose() {
|
|
1681
|
-
super.dispose();
|
|
1682
1746
|
this._childrenDisposable.dispose();
|
|
1683
|
-
this.children.forEach((child) => child.dispose());
|
|
1684
1747
|
this.splitview.dispose();
|
|
1748
|
+
this.children.forEach((child) => child.dispose());
|
|
1749
|
+
super.dispose();
|
|
1685
1750
|
}
|
|
1686
1751
|
}
|
|
1687
1752
|
|
|
@@ -1911,7 +1976,8 @@
|
|
|
1911
1976
|
if (oldRoot.children.length === 1) {
|
|
1912
1977
|
// can remove one level of redundant branching if there is only a single child
|
|
1913
1978
|
const childReference = oldRoot.children[0];
|
|
1914
|
-
oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
1979
|
+
const child = oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
1980
|
+
child.dispose();
|
|
1915
1981
|
oldRoot.dispose();
|
|
1916
1982
|
this._root.addChild(
|
|
1917
1983
|
/**
|
|
@@ -2018,7 +2084,8 @@
|
|
|
2018
2084
|
if (typeof newSiblingCachedVisibleSize === 'number') {
|
|
2019
2085
|
newSiblingSize = exports.Sizing.Invisible(newSiblingCachedVisibleSize);
|
|
2020
2086
|
}
|
|
2021
|
-
grandParent.removeChild(parentIndex);
|
|
2087
|
+
const child = grandParent.removeChild(parentIndex);
|
|
2088
|
+
child.dispose();
|
|
2022
2089
|
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize);
|
|
2023
2090
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
2024
2091
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
@@ -2044,30 +2111,36 @@
|
|
|
2044
2111
|
if (!(node instanceof LeafNode)) {
|
|
2045
2112
|
throw new Error('Invalid location');
|
|
2046
2113
|
}
|
|
2047
|
-
|
|
2114
|
+
const view = node.view;
|
|
2115
|
+
node.dispose(); // dispose of node
|
|
2116
|
+
const child = parent.removeChild(index, sizing);
|
|
2117
|
+
child.dispose();
|
|
2048
2118
|
if (parent.children.length === 0) {
|
|
2049
|
-
return
|
|
2119
|
+
return view;
|
|
2050
2120
|
}
|
|
2051
2121
|
if (parent.children.length > 1) {
|
|
2052
|
-
return
|
|
2122
|
+
return view;
|
|
2053
2123
|
}
|
|
2054
2124
|
const sibling = parent.children[0];
|
|
2055
2125
|
if (pathToParent.length === 0) {
|
|
2056
2126
|
// parent is root
|
|
2057
2127
|
if (sibling instanceof LeafNode) {
|
|
2058
|
-
return
|
|
2128
|
+
return view;
|
|
2059
2129
|
}
|
|
2060
2130
|
// we must promote sibling to be the new root
|
|
2061
|
-
parent.removeChild(0, sizing);
|
|
2131
|
+
const child = parent.removeChild(0, sizing);
|
|
2132
|
+
child.dispose();
|
|
2062
2133
|
this.root = sibling;
|
|
2063
|
-
return
|
|
2134
|
+
return view;
|
|
2064
2135
|
}
|
|
2065
2136
|
const [grandParent, ..._] = [...pathToParent].reverse();
|
|
2066
2137
|
const [parentIndex, ...__] = [...rest].reverse();
|
|
2067
2138
|
const isSiblingVisible = parent.isChildVisible(0);
|
|
2068
|
-
parent.removeChild(0, sizing);
|
|
2139
|
+
const childNode = parent.removeChild(0, sizing);
|
|
2140
|
+
childNode.dispose();
|
|
2069
2141
|
const sizes = grandParent.children.map((_size, i) => grandParent.getChildSize(i));
|
|
2070
|
-
grandParent.removeChild(parentIndex, sizing);
|
|
2142
|
+
const parentNode = grandParent.removeChild(parentIndex, sizing);
|
|
2143
|
+
parentNode.dispose();
|
|
2071
2144
|
if (sibling instanceof BranchNode) {
|
|
2072
2145
|
sizes.splice(parentIndex, 1, ...sibling.children.map((c) => c.size));
|
|
2073
2146
|
for (let i = 0; i < sibling.children.length; i++) {
|
|
@@ -2085,7 +2158,7 @@
|
|
|
2085
2158
|
for (let i = 0; i < sizes.length; i++) {
|
|
2086
2159
|
grandParent.resizeChild(i, sizes[i]);
|
|
2087
2160
|
}
|
|
2088
|
-
return
|
|
2161
|
+
return view;
|
|
2089
2162
|
}
|
|
2090
2163
|
layout(width, height) {
|
|
2091
2164
|
const [size, orthogonalSize] = this.root.orientation === exports.Orientation.HORIZONTAL
|
|
@@ -2580,6 +2653,7 @@
|
|
|
2580
2653
|
}
|
|
2581
2654
|
dispose() {
|
|
2582
2655
|
this.removeDropTarget();
|
|
2656
|
+
super.dispose();
|
|
2583
2657
|
}
|
|
2584
2658
|
toggleClasses(quadrant, width, height) {
|
|
2585
2659
|
var _a, _b, _c, _d;
|
|
@@ -2757,8 +2831,8 @@
|
|
|
2757
2831
|
if (this.panel.view) {
|
|
2758
2832
|
const _onDidFocus = this.panel.view.content.onDidFocus;
|
|
2759
2833
|
const _onDidBlur = this.panel.view.content.onDidBlur;
|
|
2760
|
-
const
|
|
2761
|
-
disposable.addDisposables(onDidFocus(() => this._onDidFocus.fire()), onDidBlur(() => this._onDidBlur.fire()));
|
|
2834
|
+
const focusTracker = trackFocus(this._element);
|
|
2835
|
+
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
|
|
2762
2836
|
if (_onDidFocus) {
|
|
2763
2837
|
disposable.addDisposables(_onDidFocus(() => this._onDidFocus.fire()));
|
|
2764
2838
|
}
|
|
@@ -2801,6 +2875,7 @@
|
|
|
2801
2875
|
this._onDragStart = new Emitter();
|
|
2802
2876
|
this.onDragStart = this._onDragStart.event;
|
|
2803
2877
|
this.iframes = [];
|
|
2878
|
+
this.addDisposables(this._onDragStart);
|
|
2804
2879
|
this.configure();
|
|
2805
2880
|
}
|
|
2806
2881
|
configure() {
|
|
@@ -2851,13 +2926,12 @@
|
|
|
2851
2926
|
this.onChanged = this._onChanged.event;
|
|
2852
2927
|
this._onDropped = new Emitter();
|
|
2853
2928
|
this.onDrop = this._onDropped.event;
|
|
2854
|
-
this.addDisposables(this._onChanged, this._onDropped);
|
|
2855
2929
|
this._element = document.createElement('div');
|
|
2856
2930
|
this._element.className = 'tab';
|
|
2857
2931
|
this._element.tabIndex = 0;
|
|
2858
2932
|
this._element.draggable = true;
|
|
2859
2933
|
toggleClass(this.element, 'inactive-tab', true);
|
|
2860
|
-
this.addDisposables(new (class Handler extends DragHandler {
|
|
2934
|
+
this.addDisposables(this._onChanged, this._onDropped, new (class Handler extends DragHandler {
|
|
2861
2935
|
constructor() {
|
|
2862
2936
|
super(...arguments);
|
|
2863
2937
|
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
@@ -2870,9 +2944,6 @@
|
|
|
2870
2944
|
},
|
|
2871
2945
|
};
|
|
2872
2946
|
}
|
|
2873
|
-
dispose() {
|
|
2874
|
-
//
|
|
2875
|
-
}
|
|
2876
2947
|
})(this._element));
|
|
2877
2948
|
this.addDisposables(addDisposableListener(this._element, 'mousedown', (event) => {
|
|
2878
2949
|
if (event.defaultPrevented) {
|
|
@@ -2907,7 +2978,7 @@
|
|
|
2907
2978
|
});
|
|
2908
2979
|
this.addDisposables(this.droptarget.onDrop((event) => {
|
|
2909
2980
|
this._onDropped.fire(event);
|
|
2910
|
-
}));
|
|
2981
|
+
}), this.droptarget);
|
|
2911
2982
|
}
|
|
2912
2983
|
setActive(isActive) {
|
|
2913
2984
|
toggleClass(this.element, 'active-tab', isActive);
|
|
@@ -2922,7 +2993,6 @@
|
|
|
2922
2993
|
}
|
|
2923
2994
|
dispose() {
|
|
2924
2995
|
super.dispose();
|
|
2925
|
-
this.droptarget.dispose();
|
|
2926
2996
|
}
|
|
2927
2997
|
}
|
|
2928
2998
|
|
|
@@ -2968,9 +3038,6 @@
|
|
|
2968
3038
|
},
|
|
2969
3039
|
};
|
|
2970
3040
|
}
|
|
2971
|
-
dispose() {
|
|
2972
|
-
//
|
|
2973
|
-
}
|
|
2974
3041
|
}
|
|
2975
3042
|
|
|
2976
3043
|
class VoidContainer extends CompositeDisposable {
|
|
@@ -3126,6 +3193,7 @@
|
|
|
3126
3193
|
const tabToRemove = this.tabs.splice(index, 1)[0];
|
|
3127
3194
|
const { value, disposable } = tabToRemove;
|
|
3128
3195
|
disposable.dispose();
|
|
3196
|
+
value.dispose();
|
|
3129
3197
|
value.element.remove();
|
|
3130
3198
|
}
|
|
3131
3199
|
setActivePanel(panel) {
|
|
@@ -3169,9 +3237,10 @@
|
|
|
3169
3237
|
}
|
|
3170
3238
|
dispose() {
|
|
3171
3239
|
super.dispose();
|
|
3172
|
-
this.tabs
|
|
3173
|
-
|
|
3174
|
-
|
|
3240
|
+
for (const { value, disposable } of this.tabs) {
|
|
3241
|
+
disposable.dispose();
|
|
3242
|
+
value.dispose();
|
|
3243
|
+
}
|
|
3175
3244
|
this.tabs = [];
|
|
3176
3245
|
}
|
|
3177
3246
|
}
|
|
@@ -3269,7 +3338,7 @@
|
|
|
3269
3338
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
3270
3339
|
this.header.hidden = !!options.hideHeader;
|
|
3271
3340
|
this.locked = !!options.locked;
|
|
3272
|
-
this.addDisposables(this.
|
|
3341
|
+
this.addDisposables(this.tabsContainer.onDrop((event) => {
|
|
3273
3342
|
this.handleDropEvent(event.event, 'center', event.index);
|
|
3274
3343
|
}), this.contentContainer.onDidFocus(() => {
|
|
3275
3344
|
this.accessor.doSetGroupActive(this.groupPanel, true);
|
|
@@ -3277,7 +3346,7 @@
|
|
|
3277
3346
|
// noop
|
|
3278
3347
|
}), this.dropTarget.onDrop((event) => {
|
|
3279
3348
|
this.handleDropEvent(event.nativeEvent, event.position);
|
|
3280
|
-
}));
|
|
3349
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
3281
3350
|
}
|
|
3282
3351
|
initialize() {
|
|
3283
3352
|
var _a, _b;
|
|
@@ -3711,8 +3780,7 @@
|
|
|
3711
3780
|
this.layout(0, 0, true); // set some elements height/widths
|
|
3712
3781
|
this.addDisposables(this.gridview.onDidChange(() => {
|
|
3713
3782
|
this._bufferOnDidLayoutChange.fire();
|
|
3714
|
-
}))
|
|
3715
|
-
this.addDisposables(exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3783
|
+
}), exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3716
3784
|
this._bufferOnDidLayoutChange.fire();
|
|
3717
3785
|
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
3718
3786
|
this._onDidLayoutChange.fire();
|
|
@@ -3815,7 +3883,6 @@
|
|
|
3815
3883
|
this.gridview.layout(width, height);
|
|
3816
3884
|
}
|
|
3817
3885
|
dispose() {
|
|
3818
|
-
super.dispose();
|
|
3819
3886
|
this._onDidActiveGroupChange.dispose();
|
|
3820
3887
|
this._onDidAddGroup.dispose();
|
|
3821
3888
|
this._onDidRemoveGroup.dispose();
|
|
@@ -3824,6 +3891,7 @@
|
|
|
3824
3891
|
group.dispose();
|
|
3825
3892
|
}
|
|
3826
3893
|
this.gridview.dispose();
|
|
3894
|
+
super.dispose();
|
|
3827
3895
|
}
|
|
3828
3896
|
}
|
|
3829
3897
|
|
|
@@ -3887,7 +3955,7 @@
|
|
|
3887
3955
|
//
|
|
3888
3956
|
this._onUpdateParameters = new Emitter();
|
|
3889
3957
|
this.onUpdateParameters = this._onUpdateParameters.event;
|
|
3890
|
-
this.addDisposables(this.
|
|
3958
|
+
this.addDisposables(this.onDidFocusChange((event) => {
|
|
3891
3959
|
this._isFocused = event.isFocused;
|
|
3892
3960
|
}), this.onDidActiveChange((event) => {
|
|
3893
3961
|
this._isActive = event.isActive;
|
|
@@ -3896,14 +3964,12 @@
|
|
|
3896
3964
|
}), this.onDidDimensionsChange((event) => {
|
|
3897
3965
|
this._width = event.width;
|
|
3898
3966
|
this._height = event.height;
|
|
3899
|
-
}));
|
|
3967
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onFocusEvent, this._onActiveChange, this._onVisibilityChange, this._onUpdateParameters);
|
|
3900
3968
|
}
|
|
3901
3969
|
initialize(panel) {
|
|
3902
3970
|
this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
|
|
3903
3971
|
panel.update({
|
|
3904
|
-
params:
|
|
3905
|
-
params: parameters,
|
|
3906
|
-
},
|
|
3972
|
+
params: parameters,
|
|
3907
3973
|
});
|
|
3908
3974
|
});
|
|
3909
3975
|
}
|
|
@@ -3998,12 +4064,12 @@
|
|
|
3998
4064
|
this._element.style.height = '100%';
|
|
3999
4065
|
this._element.style.width = '100%';
|
|
4000
4066
|
this._element.style.overflow = 'hidden';
|
|
4001
|
-
const
|
|
4002
|
-
this.addDisposables(this.api, onDidFocus(() => {
|
|
4067
|
+
const focusTracker = trackFocus(this._element);
|
|
4068
|
+
this.addDisposables(this.api, focusTracker.onDidFocus(() => {
|
|
4003
4069
|
this.api._onDidChangeFocus.fire({ isFocused: true });
|
|
4004
|
-
}), onDidBlur(() => {
|
|
4070
|
+
}), focusTracker.onDidBlur(() => {
|
|
4005
4071
|
this.api._onDidChangeFocus.fire({ isFocused: false });
|
|
4006
|
-
}));
|
|
4072
|
+
}), focusTracker);
|
|
4007
4073
|
}
|
|
4008
4074
|
focus() {
|
|
4009
4075
|
this.api._onFocusEvent.fire();
|
|
@@ -4024,7 +4090,18 @@
|
|
|
4024
4090
|
}
|
|
4025
4091
|
update(event) {
|
|
4026
4092
|
var _a, _b;
|
|
4093
|
+
// merge the new parameters with the existing parameters
|
|
4027
4094
|
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) });
|
|
4095
|
+
/**
|
|
4096
|
+
* delete new keys that have a value of undefined,
|
|
4097
|
+
* allow values of null
|
|
4098
|
+
*/
|
|
4099
|
+
for (const key of Object.keys(event.params)) {
|
|
4100
|
+
if (event.params[key] === undefined) {
|
|
4101
|
+
delete this._params.params[key];
|
|
4102
|
+
}
|
|
4103
|
+
}
|
|
4104
|
+
// update the view with the updated props
|
|
4028
4105
|
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
|
|
4029
4106
|
}
|
|
4030
4107
|
toJSON() {
|
|
@@ -4038,9 +4115,9 @@
|
|
|
4038
4115
|
}
|
|
4039
4116
|
dispose() {
|
|
4040
4117
|
var _a;
|
|
4041
|
-
super.dispose();
|
|
4042
4118
|
this.api.dispose();
|
|
4043
4119
|
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
4120
|
+
super.dispose();
|
|
4044
4121
|
}
|
|
4045
4122
|
}
|
|
4046
4123
|
|
|
@@ -4419,7 +4496,7 @@
|
|
|
4419
4496
|
this._maximumHeight = options.maximumHeight;
|
|
4420
4497
|
}
|
|
4421
4498
|
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
|
|
4422
|
-
this.addDisposables(this.
|
|
4499
|
+
this.addDisposables(this.api.onVisibilityChange((event) => {
|
|
4423
4500
|
const { isVisible } = event;
|
|
4424
4501
|
const { accessor } = this._params;
|
|
4425
4502
|
accessor.setVisible(this, isVisible);
|
|
@@ -4448,7 +4525,7 @@
|
|
|
4448
4525
|
height: event.height,
|
|
4449
4526
|
width: event.width,
|
|
4450
4527
|
});
|
|
4451
|
-
}));
|
|
4528
|
+
}), this._onDidChange);
|
|
4452
4529
|
}
|
|
4453
4530
|
setVisible(isVisible) {
|
|
4454
4531
|
this.api._onDidVisibilityChange.fire({ isVisible });
|
|
@@ -4605,7 +4682,7 @@
|
|
|
4605
4682
|
this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
|
|
4606
4683
|
}
|
|
4607
4684
|
setTitle(title) {
|
|
4608
|
-
this.panel.
|
|
4685
|
+
this.panel.setTitle(title);
|
|
4609
4686
|
}
|
|
4610
4687
|
close() {
|
|
4611
4688
|
this.group.model.closePanel(this.panel);
|
|
@@ -4627,7 +4704,6 @@
|
|
|
4627
4704
|
this.id = id;
|
|
4628
4705
|
this.containerApi = containerApi;
|
|
4629
4706
|
this.view = view;
|
|
4630
|
-
this._title = '';
|
|
4631
4707
|
this._group = group;
|
|
4632
4708
|
this.api = new DockviewPanelApiImpl(this, this._group);
|
|
4633
4709
|
this.addDisposables(this.api.onActiveChange(() => {
|
|
@@ -4640,8 +4716,8 @@
|
|
|
4640
4716
|
}
|
|
4641
4717
|
init(params) {
|
|
4642
4718
|
this._params = params.params;
|
|
4643
|
-
this.setTitle(params.title);
|
|
4644
4719
|
this.view.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));
|
|
4720
|
+
this.setTitle(params.title);
|
|
4645
4721
|
}
|
|
4646
4722
|
focus() {
|
|
4647
4723
|
this.api._onFocusEvent.fire();
|
|
@@ -4658,11 +4734,10 @@
|
|
|
4658
4734
|
};
|
|
4659
4735
|
}
|
|
4660
4736
|
setTitle(title) {
|
|
4661
|
-
|
|
4662
|
-
const didTitleChange = title !== ((_a = this._params) === null || _a === void 0 ? void 0 : _a.title);
|
|
4737
|
+
const didTitleChange = title !== this.title;
|
|
4663
4738
|
if (didTitleChange) {
|
|
4664
4739
|
this._title = title;
|
|
4665
|
-
|
|
4740
|
+
this.view.update({
|
|
4666
4741
|
params: {
|
|
4667
4742
|
params: this._params,
|
|
4668
4743
|
title: this.title,
|
|
@@ -4672,14 +4747,19 @@
|
|
|
4672
4747
|
}
|
|
4673
4748
|
}
|
|
4674
4749
|
update(event) {
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4750
|
+
// merge the new parameters with the existing parameters
|
|
4751
|
+
this._params = Object.assign(Object.assign({}, (this._params || {})), event.params);
|
|
4752
|
+
/**
|
|
4753
|
+
* delete new keys that have a value of undefined,
|
|
4754
|
+
* allow values of null
|
|
4755
|
+
*/
|
|
4756
|
+
for (const key of Object.keys(event.params)) {
|
|
4757
|
+
if (event.params[key] === undefined) {
|
|
4758
|
+
delete this._params[key];
|
|
4759
|
+
}
|
|
4681
4760
|
}
|
|
4682
|
-
|
|
4761
|
+
// update the view with the updated props
|
|
4762
|
+
this.view.update({
|
|
4683
4763
|
params: {
|
|
4684
4764
|
params: this._params,
|
|
4685
4765
|
title: this.title,
|
|
@@ -5054,7 +5134,7 @@
|
|
|
5054
5134
|
size: { type: 'pixels', value: 20 },
|
|
5055
5135
|
},
|
|
5056
5136
|
});
|
|
5057
|
-
this.addDisposables(dropTarget
|
|
5137
|
+
this.addDisposables(dropTarget.onDrop((event) => {
|
|
5058
5138
|
const data = getPanelData();
|
|
5059
5139
|
if (data) {
|
|
5060
5140
|
this.moveGroupOrPanel(this.orthogonalize(event.position), data.groupId, data.panelId || undefined, 'center');
|
|
@@ -5062,7 +5142,7 @@
|
|
|
5062
5142
|
else {
|
|
5063
5143
|
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: null, getData: getPanelData }));
|
|
5064
5144
|
}
|
|
5065
|
-
}));
|
|
5145
|
+
}), dropTarget);
|
|
5066
5146
|
this._api = new DockviewApi(this);
|
|
5067
5147
|
this.updateWatermark();
|
|
5068
5148
|
}
|
|
@@ -5386,31 +5466,33 @@
|
|
|
5386
5466
|
}
|
|
5387
5467
|
super.doRemoveGroup(group, { skipActive });
|
|
5388
5468
|
}
|
|
5389
|
-
moveGroupOrPanel(
|
|
5469
|
+
moveGroupOrPanel(destinationGroup, sourceGroupId, sourceItemId, destinationTarget, destinationIndex) {
|
|
5390
5470
|
var _a;
|
|
5391
|
-
const sourceGroup =
|
|
5392
|
-
? (_a = this._groups.get(
|
|
5471
|
+
const sourceGroup = sourceGroupId
|
|
5472
|
+
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
5393
5473
|
: undefined;
|
|
5394
|
-
if (
|
|
5474
|
+
if (sourceItemId === undefined) {
|
|
5395
5475
|
if (sourceGroup) {
|
|
5396
|
-
this.moveGroup(sourceGroup,
|
|
5476
|
+
this.moveGroup(sourceGroup, destinationGroup, destinationTarget);
|
|
5397
5477
|
}
|
|
5398
5478
|
return;
|
|
5399
5479
|
}
|
|
5400
|
-
if (!
|
|
5401
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(
|
|
5402
|
-
this.panels.find((panel) => panel.id ===
|
|
5480
|
+
if (!destinationTarget || destinationTarget === 'center') {
|
|
5481
|
+
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(sourceItemId)) ||
|
|
5482
|
+
this.panels.find((panel) => panel.id === sourceItemId);
|
|
5403
5483
|
if (!groupItem) {
|
|
5404
|
-
throw new Error(`No panel with id ${
|
|
5484
|
+
throw new Error(`No panel with id ${sourceItemId}`);
|
|
5405
5485
|
}
|
|
5406
5486
|
if ((sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.size) === 0) {
|
|
5407
5487
|
this.doRemoveGroup(sourceGroup);
|
|
5408
5488
|
}
|
|
5409
|
-
|
|
5489
|
+
destinationGroup.model.openPanel(groupItem, {
|
|
5490
|
+
index: destinationIndex,
|
|
5491
|
+
});
|
|
5410
5492
|
}
|
|
5411
5493
|
else {
|
|
5412
|
-
const referenceLocation = getGridLocation(
|
|
5413
|
-
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation,
|
|
5494
|
+
const referenceLocation = getGridLocation(destinationGroup.element);
|
|
5495
|
+
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5414
5496
|
if (sourceGroup && sourceGroup.size < 2) {
|
|
5415
5497
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
5416
5498
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
@@ -5428,18 +5510,18 @@
|
|
|
5428
5510
|
skipDispose: true,
|
|
5429
5511
|
});
|
|
5430
5512
|
// after deleting the group we need to re-evaulate the ref location
|
|
5431
|
-
const updatedReferenceLocation = getGridLocation(
|
|
5432
|
-
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation,
|
|
5513
|
+
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
5514
|
+
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
5433
5515
|
this.doAddGroup(targetGroup, location);
|
|
5434
5516
|
}
|
|
5435
5517
|
}
|
|
5436
5518
|
else {
|
|
5437
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(
|
|
5438
|
-
this.panels.find((panel) => panel.id ===
|
|
5519
|
+
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(sourceItemId)) ||
|
|
5520
|
+
this.panels.find((panel) => panel.id === sourceItemId);
|
|
5439
5521
|
if (!groupItem) {
|
|
5440
|
-
throw new Error(`No panel with id ${
|
|
5522
|
+
throw new Error(`No panel with id ${sourceItemId}`);
|
|
5441
5523
|
}
|
|
5442
|
-
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation,
|
|
5524
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5443
5525
|
const group = this.createGroupAtLocation(dropLocation);
|
|
5444
5526
|
group.model.openPanel(groupItem);
|
|
5445
5527
|
}
|
|
@@ -5533,11 +5615,11 @@
|
|
|
5533
5615
|
return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
|
|
5534
5616
|
}
|
|
5535
5617
|
dispose() {
|
|
5536
|
-
super.dispose();
|
|
5537
5618
|
this._onDidActivePanelChange.dispose();
|
|
5538
5619
|
this._onDidAddPanel.dispose();
|
|
5539
5620
|
this._onDidRemovePanel.dispose();
|
|
5540
5621
|
this._onDidLayoutFromJSON.dispose();
|
|
5622
|
+
super.dispose();
|
|
5541
5623
|
}
|
|
5542
5624
|
}
|
|
5543
5625
|
|
|
@@ -5795,7 +5877,7 @@
|
|
|
5795
5877
|
}
|
|
5796
5878
|
set splitview(value) {
|
|
5797
5879
|
this._splitview = value;
|
|
5798
|
-
this.
|
|
5880
|
+
this._splitviewChangeDisposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
|
|
5799
5881
|
this._onDidLayoutChange.fire(undefined);
|
|
5800
5882
|
}), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
|
|
5801
5883
|
}
|
|
@@ -5817,7 +5899,7 @@
|
|
|
5817
5899
|
}
|
|
5818
5900
|
constructor(options) {
|
|
5819
5901
|
super(options.parentElement);
|
|
5820
|
-
this.
|
|
5902
|
+
this._splitviewChangeDisposable = new MutableDisposable();
|
|
5821
5903
|
this._panels = new Map();
|
|
5822
5904
|
this._onDidLayoutfromJSON = new Emitter();
|
|
5823
5905
|
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
@@ -5835,7 +5917,7 @@
|
|
|
5835
5917
|
options.frameworkComponents = {};
|
|
5836
5918
|
}
|
|
5837
5919
|
this.splitview = new Splitview(this.element, options);
|
|
5838
|
-
this.addDisposables(this.
|
|
5920
|
+
this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
|
|
5839
5921
|
}
|
|
5840
5922
|
updateOptions(options) {
|
|
5841
5923
|
const hasOrientationChanged = typeof options.orientation === 'string' &&
|
|
@@ -5873,15 +5955,15 @@
|
|
|
5873
5955
|
}
|
|
5874
5956
|
}
|
|
5875
5957
|
removePanel(panel, sizing) {
|
|
5876
|
-
const
|
|
5877
|
-
if (!
|
|
5958
|
+
const item = this._panels.get(panel.id);
|
|
5959
|
+
if (!item) {
|
|
5878
5960
|
throw new Error(`unknown splitview panel ${panel.id}`);
|
|
5879
5961
|
}
|
|
5880
|
-
|
|
5881
|
-
disposable.value.dispose();
|
|
5962
|
+
item.dispose();
|
|
5882
5963
|
this._panels.delete(panel.id);
|
|
5883
5964
|
const index = this.panels.findIndex((_) => _ === panel);
|
|
5884
|
-
this.splitview.removeView(index, sizing);
|
|
5965
|
+
const removedView = this.splitview.removeView(index, sizing);
|
|
5966
|
+
removedView.dispose();
|
|
5885
5967
|
const panels = this.panels;
|
|
5886
5968
|
if (panels.length > 0) {
|
|
5887
5969
|
this.setActive(panels[panels.length - 1]);
|
|
@@ -5928,7 +6010,7 @@
|
|
|
5928
6010
|
}
|
|
5929
6011
|
this.setActive(view, true);
|
|
5930
6012
|
});
|
|
5931
|
-
this._panels.set(view.id,
|
|
6013
|
+
this._panels.set(view.id, disposable);
|
|
5932
6014
|
}
|
|
5933
6015
|
toJSON() {
|
|
5934
6016
|
var _a;
|
|
@@ -6001,20 +6083,26 @@
|
|
|
6001
6083
|
this._onDidLayoutfromJSON.fire();
|
|
6002
6084
|
}
|
|
6003
6085
|
clear() {
|
|
6004
|
-
for (const
|
|
6005
|
-
|
|
6006
|
-
value.value.dispose();
|
|
6086
|
+
for (const disposable of this._panels.values()) {
|
|
6087
|
+
disposable.dispose();
|
|
6007
6088
|
}
|
|
6008
6089
|
this._panels.clear();
|
|
6009
|
-
this.splitview.
|
|
6090
|
+
while (this.splitview.length > 0) {
|
|
6091
|
+
const view = this.splitview.removeView(0, exports.Sizing.Distribute, true);
|
|
6092
|
+
view.dispose();
|
|
6093
|
+
}
|
|
6010
6094
|
}
|
|
6011
6095
|
dispose() {
|
|
6012
|
-
for (const
|
|
6013
|
-
|
|
6014
|
-
value.value.dispose();
|
|
6096
|
+
for (const disposable of this._panels.values()) {
|
|
6097
|
+
disposable.dispose();
|
|
6015
6098
|
}
|
|
6016
6099
|
this._panels.clear();
|
|
6100
|
+
const views = this.splitview.getViews();
|
|
6101
|
+
this._splitviewChangeDisposable.dispose();
|
|
6017
6102
|
this.splitview.dispose();
|
|
6103
|
+
for (const view of views) {
|
|
6104
|
+
view.dispose();
|
|
6105
|
+
}
|
|
6018
6106
|
super.dispose();
|
|
6019
6107
|
}
|
|
6020
6108
|
}
|