dockview-core 1.7.3 → 1.7.5
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.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 +2 -2
- package/dist/cjs/dnd/abstractDragHandler.d.ts.map +1 -1
- package/dist/cjs/dnd/abstractDragHandler.js +28 -23
- 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 +5 -4
- package/dist/cjs/dockview/dockviewPanel.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewPanel.js +33 -5
- 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 +96 -9
- 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 +4 -2
- 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 -86
- 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 +281 -194
- 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 +281 -194
- package/dist/dockview-core.cjs.js +281 -194
- package/dist/dockview-core.esm.js +281 -194
- package/dist/dockview-core.esm.min.js +2 -2
- package/dist/dockview-core.js +281 -194
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.noStyle.js +281 -194
- 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 +2 -2
- package/dist/esm/dnd/abstractDragHandler.d.ts.map +1 -1
- package/dist/esm/dnd/abstractDragHandler.js +15 -10
- 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 +5 -4
- package/dist/esm/dockview/dockviewPanel.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewPanel.js +11 -5
- 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 +77 -9
- 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 +4 -2
- 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 -86
- 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.5
|
|
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,28 +188,50 @@
|
|
|
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 {
|
|
170
233
|
dispose: () => {
|
|
171
|
-
element.removeEventListener(type, listener);
|
|
234
|
+
element.removeEventListener(type, listener, options);
|
|
172
235
|
},
|
|
173
236
|
};
|
|
174
237
|
}
|
|
@@ -176,7 +239,7 @@
|
|
|
176
239
|
element.addEventListener(type, listener, options);
|
|
177
240
|
return {
|
|
178
241
|
dispose: () => {
|
|
179
|
-
element.removeEventListener(type, listener);
|
|
242
|
+
element.removeEventListener(type, listener, options);
|
|
180
243
|
},
|
|
181
244
|
};
|
|
182
245
|
}
|
|
@@ -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) {
|
|
@@ -941,12 +1003,10 @@
|
|
|
941
1003
|
this.saveProportions();
|
|
942
1004
|
document.removeEventListener('mousemove', mousemove);
|
|
943
1005
|
document.removeEventListener('mouseup', end);
|
|
944
|
-
document.removeEventListener('mouseend', end);
|
|
945
1006
|
this._onDidSashEnd.fire(undefined);
|
|
946
1007
|
};
|
|
947
1008
|
document.addEventListener('mousemove', mousemove);
|
|
948
1009
|
document.addEventListener('mouseup', end);
|
|
949
|
-
document.addEventListener('mouseend', end);
|
|
950
1010
|
};
|
|
951
1011
|
sash.addEventListener('mousedown', onStart);
|
|
952
1012
|
const sashItem = {
|
|
@@ -972,7 +1032,7 @@
|
|
|
972
1032
|
distributeViewSizes() {
|
|
973
1033
|
const flexibleViewItems = [];
|
|
974
1034
|
let flexibleSize = 0;
|
|
975
|
-
for (const item of this.
|
|
1035
|
+
for (const item of this.viewItems) {
|
|
976
1036
|
if (item.maximumSize - item.minimumSize > 0) {
|
|
977
1037
|
flexibleViewItems.push(item);
|
|
978
1038
|
flexibleSize += item.size;
|
|
@@ -982,17 +1042,17 @@
|
|
|
982
1042
|
for (const item of flexibleViewItems) {
|
|
983
1043
|
item.size = clamp(size, item.minimumSize, item.maximumSize);
|
|
984
1044
|
}
|
|
985
|
-
const indexes = range(this.
|
|
986
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
987
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1045
|
+
const indexes = range(this.viewItems.length);
|
|
1046
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1047
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
988
1048
|
this.relayout(lowPriorityIndexes, highPriorityIndexes);
|
|
989
1049
|
}
|
|
990
1050
|
removeView(index, sizing, skipLayout = false) {
|
|
991
1051
|
// Remove view
|
|
992
|
-
const viewItem = this.
|
|
1052
|
+
const viewItem = this.viewItems.splice(index, 1)[0];
|
|
993
1053
|
viewItem.dispose();
|
|
994
1054
|
// Remove sash
|
|
995
|
-
if (this.
|
|
1055
|
+
if (this.viewItems.length >= 1) {
|
|
996
1056
|
const sashIndex = Math.max(index - 1, 0);
|
|
997
1057
|
const sashItem = this.sashes.splice(sashIndex, 1)[0];
|
|
998
1058
|
sashItem.disposable();
|
|
@@ -1007,10 +1067,10 @@
|
|
|
1007
1067
|
return viewItem.view;
|
|
1008
1068
|
}
|
|
1009
1069
|
getViewCachedVisibleSize(index) {
|
|
1010
|
-
if (index < 0 || index >= this.
|
|
1070
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
1011
1071
|
throw new Error('Index out of bounds');
|
|
1012
1072
|
}
|
|
1013
|
-
const viewItem = this.
|
|
1073
|
+
const viewItem = this.viewItems[index];
|
|
1014
1074
|
return viewItem.cachedVisibleSize;
|
|
1015
1075
|
}
|
|
1016
1076
|
moveView(from, to) {
|
|
@@ -1026,14 +1086,14 @@
|
|
|
1026
1086
|
this.size = size;
|
|
1027
1087
|
this.orthogonalSize = orthogonalSize;
|
|
1028
1088
|
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.
|
|
1089
|
+
const indexes = range(this.viewItems.length);
|
|
1090
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1091
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1092
|
+
this.resize(this.viewItems.length - 1, size - previousSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
1033
1093
|
}
|
|
1034
1094
|
else {
|
|
1035
|
-
for (let i = 0; i < this.
|
|
1036
|
-
const item = this.
|
|
1095
|
+
for (let i = 0; i < this.viewItems.length; i++) {
|
|
1096
|
+
const item = this.viewItems[i];
|
|
1037
1097
|
item.size = clamp(Math.round(this.proportions[i] * size), item.minimumSize, item.maximumSize);
|
|
1038
1098
|
}
|
|
1039
1099
|
}
|
|
@@ -1041,18 +1101,18 @@
|
|
|
1041
1101
|
this.layoutViews();
|
|
1042
1102
|
}
|
|
1043
1103
|
relayout(lowPriorityIndexes, highPriorityIndexes) {
|
|
1044
|
-
const contentSize = this.
|
|
1045
|
-
this.resize(this.
|
|
1104
|
+
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1105
|
+
this.resize(this.viewItems.length - 1, this._size - contentSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
1046
1106
|
this.distributeEmptySpace();
|
|
1047
1107
|
this.layoutViews();
|
|
1048
1108
|
this.saveProportions();
|
|
1049
1109
|
}
|
|
1050
1110
|
distributeEmptySpace(lowPriorityIndex) {
|
|
1051
|
-
const contentSize = this.
|
|
1111
|
+
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1052
1112
|
let emptyDelta = this.size - contentSize;
|
|
1053
|
-
const indexes = range(this.
|
|
1054
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
1055
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1113
|
+
const indexes = range(this.viewItems.length - 1, -1);
|
|
1114
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1115
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1056
1116
|
for (const index of highPriorityIndexes) {
|
|
1057
1117
|
pushToStart(indexes, index);
|
|
1058
1118
|
}
|
|
@@ -1063,7 +1123,7 @@
|
|
|
1063
1123
|
pushToEnd(indexes, lowPriorityIndex);
|
|
1064
1124
|
}
|
|
1065
1125
|
for (let i = 0; emptyDelta !== 0 && i < indexes.length; i++) {
|
|
1066
|
-
const item = this.
|
|
1126
|
+
const item = this.viewItems[indexes[i]];
|
|
1067
1127
|
const size = clamp(item.size + emptyDelta, item.minimumSize, item.maximumSize);
|
|
1068
1128
|
const viewDelta = size - item.size;
|
|
1069
1129
|
emptyDelta -= viewDelta;
|
|
@@ -1072,16 +1132,16 @@
|
|
|
1072
1132
|
}
|
|
1073
1133
|
saveProportions() {
|
|
1074
1134
|
if (this.proportionalLayout && this.contentSize > 0) {
|
|
1075
|
-
this._proportions = this.
|
|
1135
|
+
this._proportions = this.viewItems.map((i) => i.size / this.contentSize);
|
|
1076
1136
|
}
|
|
1077
1137
|
}
|
|
1078
1138
|
layoutViews() {
|
|
1079
|
-
this.contentSize = this.
|
|
1139
|
+
this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1080
1140
|
let sum = 0;
|
|
1081
1141
|
const x = [];
|
|
1082
1142
|
this.updateSashEnablement();
|
|
1083
|
-
for (let i = 0; i < this.
|
|
1084
|
-
sum += this.
|
|
1143
|
+
for (let i = 0; i < this.viewItems.length - 1; i++) {
|
|
1144
|
+
sum += this.viewItems[i].size;
|
|
1085
1145
|
x.push(sum);
|
|
1086
1146
|
const offset = Math.min(Math.max(0, sum - 2), this.size - 4);
|
|
1087
1147
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
@@ -1093,7 +1153,7 @@
|
|
|
1093
1153
|
this.sashes[i].container.style.top = `${offset}px`;
|
|
1094
1154
|
}
|
|
1095
1155
|
}
|
|
1096
|
-
this.
|
|
1156
|
+
this.viewItems.forEach((view, i) => {
|
|
1097
1157
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
1098
1158
|
view.container.style.width = `${view.size}px`;
|
|
1099
1159
|
view.container.style.left = i == 0 ? '0px' : `${x[i - 1]}px`;
|
|
@@ -1112,7 +1172,7 @@
|
|
|
1112
1172
|
findFirstSnapIndex(indexes) {
|
|
1113
1173
|
// visible views first
|
|
1114
1174
|
for (const index of indexes) {
|
|
1115
|
-
const viewItem = this.
|
|
1175
|
+
const viewItem = this.viewItems[index];
|
|
1116
1176
|
if (!viewItem.visible) {
|
|
1117
1177
|
continue;
|
|
1118
1178
|
}
|
|
@@ -1122,7 +1182,7 @@
|
|
|
1122
1182
|
}
|
|
1123
1183
|
// then, hidden views
|
|
1124
1184
|
for (const index of indexes) {
|
|
1125
|
-
const viewItem = this.
|
|
1185
|
+
const viewItem = this.viewItems[index];
|
|
1126
1186
|
if (viewItem.visible &&
|
|
1127
1187
|
viewItem.maximumSize - viewItem.minimumSize > 0) {
|
|
1128
1188
|
return undefined;
|
|
@@ -1135,10 +1195,10 @@
|
|
|
1135
1195
|
}
|
|
1136
1196
|
updateSashEnablement() {
|
|
1137
1197
|
let previous = false;
|
|
1138
|
-
const collapsesDown = this.
|
|
1198
|
+
const collapsesDown = this.viewItems.map((i) => (previous = i.size - i.minimumSize > 0 || previous));
|
|
1139
1199
|
previous = false;
|
|
1140
|
-
const expandsDown = this.
|
|
1141
|
-
const reverseViews = [...this.
|
|
1200
|
+
const expandsDown = this.viewItems.map((i) => (previous = i.maximumSize - i.size > 0 || previous));
|
|
1201
|
+
const reverseViews = [...this.viewItems].reverse();
|
|
1142
1202
|
previous = false;
|
|
1143
1203
|
const collapsesUp = reverseViews
|
|
1144
1204
|
.map((i) => (previous = i.size - i.minimumSize > 0 || previous))
|
|
@@ -1150,19 +1210,19 @@
|
|
|
1150
1210
|
let position = 0;
|
|
1151
1211
|
for (let index = 0; index < this.sashes.length; index++) {
|
|
1152
1212
|
const sash = this.sashes[index];
|
|
1153
|
-
const viewItem = this.
|
|
1213
|
+
const viewItem = this.viewItems[index];
|
|
1154
1214
|
position += viewItem.size;
|
|
1155
1215
|
const min = !(collapsesDown[index] && expandsUp[index + 1]);
|
|
1156
1216
|
const max = !(expandsDown[index] && collapsesUp[index + 1]);
|
|
1157
1217
|
if (min && max) {
|
|
1158
1218
|
const upIndexes = range(index, -1);
|
|
1159
|
-
const downIndexes = range(index + 1, this.
|
|
1219
|
+
const downIndexes = range(index + 1, this.viewItems.length);
|
|
1160
1220
|
const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);
|
|
1161
1221
|
const snapAfterIndex = this.findFirstSnapIndex(downIndexes);
|
|
1162
1222
|
const snappedBefore = typeof snapBeforeIndex === 'number' &&
|
|
1163
|
-
!this.
|
|
1223
|
+
!this.viewItems[snapBeforeIndex].visible;
|
|
1164
1224
|
const snappedAfter = typeof snapAfterIndex === 'number' &&
|
|
1165
|
-
!this.
|
|
1225
|
+
!this.viewItems[snapAfterIndex].visible;
|
|
1166
1226
|
if (snappedBefore &&
|
|
1167
1227
|
collapsesUp[index] &&
|
|
1168
1228
|
(position > 0 || this.startSnappingEnabled)) {
|
|
@@ -1222,6 +1282,9 @@
|
|
|
1222
1282
|
break;
|
|
1223
1283
|
}
|
|
1224
1284
|
}
|
|
1285
|
+
for (const viewItem of this.viewItems) {
|
|
1286
|
+
viewItem.dispose();
|
|
1287
|
+
}
|
|
1225
1288
|
this.element.remove();
|
|
1226
1289
|
}
|
|
1227
1290
|
}
|
|
@@ -1656,7 +1719,7 @@
|
|
|
1656
1719
|
throw new Error('Invalid index');
|
|
1657
1720
|
}
|
|
1658
1721
|
this.splitview.removeView(index, sizing);
|
|
1659
|
-
this._removeChild(index);
|
|
1722
|
+
return this._removeChild(index);
|
|
1660
1723
|
}
|
|
1661
1724
|
_addChild(node, index) {
|
|
1662
1725
|
this.children.splice(index, 0, node);
|
|
@@ -1678,10 +1741,10 @@
|
|
|
1678
1741
|
});
|
|
1679
1742
|
}
|
|
1680
1743
|
dispose() {
|
|
1681
|
-
super.dispose();
|
|
1682
1744
|
this._childrenDisposable.dispose();
|
|
1683
|
-
this.children.forEach((child) => child.dispose());
|
|
1684
1745
|
this.splitview.dispose();
|
|
1746
|
+
this.children.forEach((child) => child.dispose());
|
|
1747
|
+
super.dispose();
|
|
1685
1748
|
}
|
|
1686
1749
|
}
|
|
1687
1750
|
|
|
@@ -1911,7 +1974,8 @@
|
|
|
1911
1974
|
if (oldRoot.children.length === 1) {
|
|
1912
1975
|
// can remove one level of redundant branching if there is only a single child
|
|
1913
1976
|
const childReference = oldRoot.children[0];
|
|
1914
|
-
oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
1977
|
+
const child = oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
1978
|
+
child.dispose();
|
|
1915
1979
|
oldRoot.dispose();
|
|
1916
1980
|
this._root.addChild(
|
|
1917
1981
|
/**
|
|
@@ -2018,7 +2082,8 @@
|
|
|
2018
2082
|
if (typeof newSiblingCachedVisibleSize === 'number') {
|
|
2019
2083
|
newSiblingSize = exports.Sizing.Invisible(newSiblingCachedVisibleSize);
|
|
2020
2084
|
}
|
|
2021
|
-
grandParent.removeChild(parentIndex);
|
|
2085
|
+
const child = grandParent.removeChild(parentIndex);
|
|
2086
|
+
child.dispose();
|
|
2022
2087
|
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize);
|
|
2023
2088
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
2024
2089
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
@@ -2580,6 +2645,7 @@
|
|
|
2580
2645
|
}
|
|
2581
2646
|
dispose() {
|
|
2582
2647
|
this.removeDropTarget();
|
|
2648
|
+
super.dispose();
|
|
2583
2649
|
}
|
|
2584
2650
|
toggleClasses(quadrant, width, height) {
|
|
2585
2651
|
var _a, _b, _c, _d;
|
|
@@ -2757,8 +2823,8 @@
|
|
|
2757
2823
|
if (this.panel.view) {
|
|
2758
2824
|
const _onDidFocus = this.panel.view.content.onDidFocus;
|
|
2759
2825
|
const _onDidBlur = this.panel.view.content.onDidBlur;
|
|
2760
|
-
const
|
|
2761
|
-
disposable.addDisposables(onDidFocus(() => this._onDidFocus.fire()), onDidBlur(() => this._onDidBlur.fire()));
|
|
2826
|
+
const focusTracker = trackFocus(this._element);
|
|
2827
|
+
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
|
|
2762
2828
|
if (_onDidFocus) {
|
|
2763
2829
|
disposable.addDisposables(_onDidFocus(() => this._onDidFocus.fire()));
|
|
2764
2830
|
}
|
|
@@ -2797,24 +2863,32 @@
|
|
|
2797
2863
|
constructor(el) {
|
|
2798
2864
|
super();
|
|
2799
2865
|
this.el = el;
|
|
2800
|
-
this.
|
|
2866
|
+
this.dataDisposable = new MutableDisposable();
|
|
2867
|
+
this.pointerEventsDisposable = new MutableDisposable();
|
|
2801
2868
|
this._onDragStart = new Emitter();
|
|
2802
2869
|
this.onDragStart = this._onDragStart.event;
|
|
2803
|
-
this.
|
|
2870
|
+
this.addDisposables(this._onDragStart, this.dataDisposable, this.pointerEventsDisposable);
|
|
2804
2871
|
this.configure();
|
|
2805
2872
|
}
|
|
2806
2873
|
configure() {
|
|
2807
2874
|
this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
|
|
2808
|
-
|
|
2875
|
+
const iframes = [
|
|
2809
2876
|
...getElementsByTagName('iframe'),
|
|
2810
2877
|
...getElementsByTagName('webview'),
|
|
2811
2878
|
];
|
|
2812
|
-
|
|
2879
|
+
this.pointerEventsDisposable.value = {
|
|
2880
|
+
dispose: () => {
|
|
2881
|
+
for (const iframe of iframes) {
|
|
2882
|
+
iframe.style.pointerEvents = 'auto';
|
|
2883
|
+
}
|
|
2884
|
+
},
|
|
2885
|
+
};
|
|
2886
|
+
for (const iframe of iframes) {
|
|
2813
2887
|
iframe.style.pointerEvents = 'none';
|
|
2814
2888
|
}
|
|
2815
2889
|
this.el.classList.add('dv-dragged');
|
|
2816
2890
|
setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
|
|
2817
|
-
this.
|
|
2891
|
+
this.dataDisposable.value = this.getData(event.dataTransfer);
|
|
2818
2892
|
if (event.dataTransfer) {
|
|
2819
2893
|
event.dataTransfer.effectAllowed = 'move';
|
|
2820
2894
|
/**
|
|
@@ -2829,11 +2903,8 @@
|
|
|
2829
2903
|
event.dataTransfer.setData('text/plain', '__dockview_internal_drag_event__');
|
|
2830
2904
|
}
|
|
2831
2905
|
}), addDisposableListener(this.el, 'dragend', () => {
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
}
|
|
2835
|
-
this.iframes = [];
|
|
2836
|
-
this.disposable.dispose();
|
|
2906
|
+
this.pointerEventsDisposable.dispose();
|
|
2907
|
+
this.dataDisposable.dispose();
|
|
2837
2908
|
}));
|
|
2838
2909
|
}
|
|
2839
2910
|
}
|
|
@@ -2851,13 +2922,12 @@
|
|
|
2851
2922
|
this.onChanged = this._onChanged.event;
|
|
2852
2923
|
this._onDropped = new Emitter();
|
|
2853
2924
|
this.onDrop = this._onDropped.event;
|
|
2854
|
-
this.addDisposables(this._onChanged, this._onDropped);
|
|
2855
2925
|
this._element = document.createElement('div');
|
|
2856
2926
|
this._element.className = 'tab';
|
|
2857
2927
|
this._element.tabIndex = 0;
|
|
2858
2928
|
this._element.draggable = true;
|
|
2859
2929
|
toggleClass(this.element, 'inactive-tab', true);
|
|
2860
|
-
this.addDisposables(new (class Handler extends DragHandler {
|
|
2930
|
+
this.addDisposables(this._onChanged, this._onDropped, new (class Handler extends DragHandler {
|
|
2861
2931
|
constructor() {
|
|
2862
2932
|
super(...arguments);
|
|
2863
2933
|
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
@@ -2870,9 +2940,6 @@
|
|
|
2870
2940
|
},
|
|
2871
2941
|
};
|
|
2872
2942
|
}
|
|
2873
|
-
dispose() {
|
|
2874
|
-
//
|
|
2875
|
-
}
|
|
2876
2943
|
})(this._element));
|
|
2877
2944
|
this.addDisposables(addDisposableListener(this._element, 'mousedown', (event) => {
|
|
2878
2945
|
if (event.defaultPrevented) {
|
|
@@ -2907,7 +2974,7 @@
|
|
|
2907
2974
|
});
|
|
2908
2975
|
this.addDisposables(this.droptarget.onDrop((event) => {
|
|
2909
2976
|
this._onDropped.fire(event);
|
|
2910
|
-
}));
|
|
2977
|
+
}), this.droptarget);
|
|
2911
2978
|
}
|
|
2912
2979
|
setActive(isActive) {
|
|
2913
2980
|
toggleClass(this.element, 'active-tab', isActive);
|
|
@@ -2922,7 +2989,6 @@
|
|
|
2922
2989
|
}
|
|
2923
2990
|
dispose() {
|
|
2924
2991
|
super.dispose();
|
|
2925
|
-
this.droptarget.dispose();
|
|
2926
2992
|
}
|
|
2927
2993
|
}
|
|
2928
2994
|
|
|
@@ -2968,9 +3034,6 @@
|
|
|
2968
3034
|
},
|
|
2969
3035
|
};
|
|
2970
3036
|
}
|
|
2971
|
-
dispose() {
|
|
2972
|
-
//
|
|
2973
|
-
}
|
|
2974
3037
|
}
|
|
2975
3038
|
|
|
2976
3039
|
class VoidContainer extends CompositeDisposable {
|
|
@@ -3126,6 +3189,7 @@
|
|
|
3126
3189
|
const tabToRemove = this.tabs.splice(index, 1)[0];
|
|
3127
3190
|
const { value, disposable } = tabToRemove;
|
|
3128
3191
|
disposable.dispose();
|
|
3192
|
+
value.dispose();
|
|
3129
3193
|
value.element.remove();
|
|
3130
3194
|
}
|
|
3131
3195
|
setActivePanel(panel) {
|
|
@@ -3169,9 +3233,10 @@
|
|
|
3169
3233
|
}
|
|
3170
3234
|
dispose() {
|
|
3171
3235
|
super.dispose();
|
|
3172
|
-
this.tabs
|
|
3173
|
-
|
|
3174
|
-
|
|
3236
|
+
for (const { value, disposable } of this.tabs) {
|
|
3237
|
+
disposable.dispose();
|
|
3238
|
+
value.dispose();
|
|
3239
|
+
}
|
|
3175
3240
|
this.tabs = [];
|
|
3176
3241
|
}
|
|
3177
3242
|
}
|
|
@@ -3269,7 +3334,7 @@
|
|
|
3269
3334
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
3270
3335
|
this.header.hidden = !!options.hideHeader;
|
|
3271
3336
|
this.locked = !!options.locked;
|
|
3272
|
-
this.addDisposables(this.
|
|
3337
|
+
this.addDisposables(this.tabsContainer.onDrop((event) => {
|
|
3273
3338
|
this.handleDropEvent(event.event, 'center', event.index);
|
|
3274
3339
|
}), this.contentContainer.onDidFocus(() => {
|
|
3275
3340
|
this.accessor.doSetGroupActive(this.groupPanel, true);
|
|
@@ -3277,7 +3342,7 @@
|
|
|
3277
3342
|
// noop
|
|
3278
3343
|
}), this.dropTarget.onDrop((event) => {
|
|
3279
3344
|
this.handleDropEvent(event.nativeEvent, event.position);
|
|
3280
|
-
}));
|
|
3345
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
3281
3346
|
}
|
|
3282
3347
|
initialize() {
|
|
3283
3348
|
var _a, _b;
|
|
@@ -3711,8 +3776,7 @@
|
|
|
3711
3776
|
this.layout(0, 0, true); // set some elements height/widths
|
|
3712
3777
|
this.addDisposables(this.gridview.onDidChange(() => {
|
|
3713
3778
|
this._bufferOnDidLayoutChange.fire();
|
|
3714
|
-
}))
|
|
3715
|
-
this.addDisposables(exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3779
|
+
}), exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3716
3780
|
this._bufferOnDidLayoutChange.fire();
|
|
3717
3781
|
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
3718
3782
|
this._onDidLayoutChange.fire();
|
|
@@ -3815,7 +3879,6 @@
|
|
|
3815
3879
|
this.gridview.layout(width, height);
|
|
3816
3880
|
}
|
|
3817
3881
|
dispose() {
|
|
3818
|
-
super.dispose();
|
|
3819
3882
|
this._onDidActiveGroupChange.dispose();
|
|
3820
3883
|
this._onDidAddGroup.dispose();
|
|
3821
3884
|
this._onDidRemoveGroup.dispose();
|
|
@@ -3824,6 +3887,7 @@
|
|
|
3824
3887
|
group.dispose();
|
|
3825
3888
|
}
|
|
3826
3889
|
this.gridview.dispose();
|
|
3890
|
+
super.dispose();
|
|
3827
3891
|
}
|
|
3828
3892
|
}
|
|
3829
3893
|
|
|
@@ -3887,7 +3951,7 @@
|
|
|
3887
3951
|
//
|
|
3888
3952
|
this._onUpdateParameters = new Emitter();
|
|
3889
3953
|
this.onUpdateParameters = this._onUpdateParameters.event;
|
|
3890
|
-
this.addDisposables(this.
|
|
3954
|
+
this.addDisposables(this.onDidFocusChange((event) => {
|
|
3891
3955
|
this._isFocused = event.isFocused;
|
|
3892
3956
|
}), this.onDidActiveChange((event) => {
|
|
3893
3957
|
this._isActive = event.isActive;
|
|
@@ -3896,14 +3960,12 @@
|
|
|
3896
3960
|
}), this.onDidDimensionsChange((event) => {
|
|
3897
3961
|
this._width = event.width;
|
|
3898
3962
|
this._height = event.height;
|
|
3899
|
-
}));
|
|
3963
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onFocusEvent, this._onActiveChange, this._onVisibilityChange, this._onUpdateParameters);
|
|
3900
3964
|
}
|
|
3901
3965
|
initialize(panel) {
|
|
3902
3966
|
this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
|
|
3903
3967
|
panel.update({
|
|
3904
|
-
params:
|
|
3905
|
-
params: parameters,
|
|
3906
|
-
},
|
|
3968
|
+
params: parameters,
|
|
3907
3969
|
});
|
|
3908
3970
|
});
|
|
3909
3971
|
}
|
|
@@ -3998,12 +4060,12 @@
|
|
|
3998
4060
|
this._element.style.height = '100%';
|
|
3999
4061
|
this._element.style.width = '100%';
|
|
4000
4062
|
this._element.style.overflow = 'hidden';
|
|
4001
|
-
const
|
|
4002
|
-
this.addDisposables(this.api, onDidFocus(() => {
|
|
4063
|
+
const focusTracker = trackFocus(this._element);
|
|
4064
|
+
this.addDisposables(this.api, focusTracker.onDidFocus(() => {
|
|
4003
4065
|
this.api._onDidChangeFocus.fire({ isFocused: true });
|
|
4004
|
-
}), onDidBlur(() => {
|
|
4066
|
+
}), focusTracker.onDidBlur(() => {
|
|
4005
4067
|
this.api._onDidChangeFocus.fire({ isFocused: false });
|
|
4006
|
-
}));
|
|
4068
|
+
}), focusTracker);
|
|
4007
4069
|
}
|
|
4008
4070
|
focus() {
|
|
4009
4071
|
this.api._onFocusEvent.fire();
|
|
@@ -4024,7 +4086,18 @@
|
|
|
4024
4086
|
}
|
|
4025
4087
|
update(event) {
|
|
4026
4088
|
var _a, _b;
|
|
4089
|
+
// merge the new parameters with the existing parameters
|
|
4027
4090
|
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) });
|
|
4091
|
+
/**
|
|
4092
|
+
* delete new keys that have a value of undefined,
|
|
4093
|
+
* allow values of null
|
|
4094
|
+
*/
|
|
4095
|
+
for (const key of Object.keys(event.params)) {
|
|
4096
|
+
if (event.params[key] === undefined) {
|
|
4097
|
+
delete this._params.params[key];
|
|
4098
|
+
}
|
|
4099
|
+
}
|
|
4100
|
+
// update the view with the updated props
|
|
4028
4101
|
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
|
|
4029
4102
|
}
|
|
4030
4103
|
toJSON() {
|
|
@@ -4038,9 +4111,9 @@
|
|
|
4038
4111
|
}
|
|
4039
4112
|
dispose() {
|
|
4040
4113
|
var _a;
|
|
4041
|
-
super.dispose();
|
|
4042
4114
|
this.api.dispose();
|
|
4043
4115
|
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
4116
|
+
super.dispose();
|
|
4044
4117
|
}
|
|
4045
4118
|
}
|
|
4046
4119
|
|
|
@@ -4419,7 +4492,7 @@
|
|
|
4419
4492
|
this._maximumHeight = options.maximumHeight;
|
|
4420
4493
|
}
|
|
4421
4494
|
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
|
|
4422
|
-
this.addDisposables(this.
|
|
4495
|
+
this.addDisposables(this.api.onVisibilityChange((event) => {
|
|
4423
4496
|
const { isVisible } = event;
|
|
4424
4497
|
const { accessor } = this._params;
|
|
4425
4498
|
accessor.setVisible(this, isVisible);
|
|
@@ -4448,7 +4521,7 @@
|
|
|
4448
4521
|
height: event.height,
|
|
4449
4522
|
width: event.width,
|
|
4450
4523
|
});
|
|
4451
|
-
}));
|
|
4524
|
+
}), this._onDidChange);
|
|
4452
4525
|
}
|
|
4453
4526
|
setVisible(isVisible) {
|
|
4454
4527
|
this.api._onDidVisibilityChange.fire({ isVisible });
|
|
@@ -4605,7 +4678,7 @@
|
|
|
4605
4678
|
this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
|
|
4606
4679
|
}
|
|
4607
4680
|
setTitle(title) {
|
|
4608
|
-
this.panel.
|
|
4681
|
+
this.panel.setTitle(title);
|
|
4609
4682
|
}
|
|
4610
4683
|
close() {
|
|
4611
4684
|
this.group.model.closePanel(this.panel);
|
|
@@ -4670,12 +4743,18 @@
|
|
|
4670
4743
|
}
|
|
4671
4744
|
}
|
|
4672
4745
|
update(event) {
|
|
4673
|
-
|
|
4674
|
-
this._params = Object.assign(Object.assign({}, (this._params || {})), event.params
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4746
|
+
// merge the new parameters with the existing parameters
|
|
4747
|
+
this._params = Object.assign(Object.assign({}, (this._params || {})), event.params);
|
|
4748
|
+
/**
|
|
4749
|
+
* delete new keys that have a value of undefined,
|
|
4750
|
+
* allow values of null
|
|
4751
|
+
*/
|
|
4752
|
+
for (const key of Object.keys(event.params)) {
|
|
4753
|
+
if (event.params[key] === undefined) {
|
|
4754
|
+
delete this._params[key];
|
|
4755
|
+
}
|
|
4678
4756
|
}
|
|
4757
|
+
// update the view with the updated props
|
|
4679
4758
|
this.view.update({
|
|
4680
4759
|
params: {
|
|
4681
4760
|
params: this._params,
|
|
@@ -5051,7 +5130,7 @@
|
|
|
5051
5130
|
size: { type: 'pixels', value: 20 },
|
|
5052
5131
|
},
|
|
5053
5132
|
});
|
|
5054
|
-
this.addDisposables(dropTarget
|
|
5133
|
+
this.addDisposables(dropTarget.onDrop((event) => {
|
|
5055
5134
|
const data = getPanelData();
|
|
5056
5135
|
if (data) {
|
|
5057
5136
|
this.moveGroupOrPanel(this.orthogonalize(event.position), data.groupId, data.panelId || undefined, 'center');
|
|
@@ -5059,7 +5138,7 @@
|
|
|
5059
5138
|
else {
|
|
5060
5139
|
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: null, getData: getPanelData }));
|
|
5061
5140
|
}
|
|
5062
|
-
}));
|
|
5141
|
+
}), dropTarget);
|
|
5063
5142
|
this._api = new DockviewApi(this);
|
|
5064
5143
|
this.updateWatermark();
|
|
5065
5144
|
}
|
|
@@ -5383,31 +5462,33 @@
|
|
|
5383
5462
|
}
|
|
5384
5463
|
super.doRemoveGroup(group, { skipActive });
|
|
5385
5464
|
}
|
|
5386
|
-
moveGroupOrPanel(
|
|
5465
|
+
moveGroupOrPanel(destinationGroup, sourceGroupId, sourceItemId, destinationTarget, destinationIndex) {
|
|
5387
5466
|
var _a;
|
|
5388
|
-
const sourceGroup =
|
|
5389
|
-
? (_a = this._groups.get(
|
|
5467
|
+
const sourceGroup = sourceGroupId
|
|
5468
|
+
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
5390
5469
|
: undefined;
|
|
5391
|
-
if (
|
|
5470
|
+
if (sourceItemId === undefined) {
|
|
5392
5471
|
if (sourceGroup) {
|
|
5393
|
-
this.moveGroup(sourceGroup,
|
|
5472
|
+
this.moveGroup(sourceGroup, destinationGroup, destinationTarget);
|
|
5394
5473
|
}
|
|
5395
5474
|
return;
|
|
5396
5475
|
}
|
|
5397
|
-
if (!
|
|
5398
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(
|
|
5399
|
-
this.panels.find((panel) => panel.id ===
|
|
5476
|
+
if (!destinationTarget || destinationTarget === 'center') {
|
|
5477
|
+
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(sourceItemId)) ||
|
|
5478
|
+
this.panels.find((panel) => panel.id === sourceItemId);
|
|
5400
5479
|
if (!groupItem) {
|
|
5401
|
-
throw new Error(`No panel with id ${
|
|
5480
|
+
throw new Error(`No panel with id ${sourceItemId}`);
|
|
5402
5481
|
}
|
|
5403
5482
|
if ((sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.size) === 0) {
|
|
5404
5483
|
this.doRemoveGroup(sourceGroup);
|
|
5405
5484
|
}
|
|
5406
|
-
|
|
5485
|
+
destinationGroup.model.openPanel(groupItem, {
|
|
5486
|
+
index: destinationIndex,
|
|
5487
|
+
});
|
|
5407
5488
|
}
|
|
5408
5489
|
else {
|
|
5409
|
-
const referenceLocation = getGridLocation(
|
|
5410
|
-
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation,
|
|
5490
|
+
const referenceLocation = getGridLocation(destinationGroup.element);
|
|
5491
|
+
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5411
5492
|
if (sourceGroup && sourceGroup.size < 2) {
|
|
5412
5493
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
5413
5494
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
@@ -5425,18 +5506,18 @@
|
|
|
5425
5506
|
skipDispose: true,
|
|
5426
5507
|
});
|
|
5427
5508
|
// after deleting the group we need to re-evaulate the ref location
|
|
5428
|
-
const updatedReferenceLocation = getGridLocation(
|
|
5429
|
-
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation,
|
|
5509
|
+
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
5510
|
+
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
5430
5511
|
this.doAddGroup(targetGroup, location);
|
|
5431
5512
|
}
|
|
5432
5513
|
}
|
|
5433
5514
|
else {
|
|
5434
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(
|
|
5435
|
-
this.panels.find((panel) => panel.id ===
|
|
5515
|
+
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(sourceItemId)) ||
|
|
5516
|
+
this.panels.find((panel) => panel.id === sourceItemId);
|
|
5436
5517
|
if (!groupItem) {
|
|
5437
|
-
throw new Error(`No panel with id ${
|
|
5518
|
+
throw new Error(`No panel with id ${sourceItemId}`);
|
|
5438
5519
|
}
|
|
5439
|
-
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation,
|
|
5520
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5440
5521
|
const group = this.createGroupAtLocation(dropLocation);
|
|
5441
5522
|
group.model.openPanel(groupItem);
|
|
5442
5523
|
}
|
|
@@ -5530,11 +5611,11 @@
|
|
|
5530
5611
|
return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
|
|
5531
5612
|
}
|
|
5532
5613
|
dispose() {
|
|
5533
|
-
super.dispose();
|
|
5534
5614
|
this._onDidActivePanelChange.dispose();
|
|
5535
5615
|
this._onDidAddPanel.dispose();
|
|
5536
5616
|
this._onDidRemovePanel.dispose();
|
|
5537
5617
|
this._onDidLayoutFromJSON.dispose();
|
|
5618
|
+
super.dispose();
|
|
5538
5619
|
}
|
|
5539
5620
|
}
|
|
5540
5621
|
|
|
@@ -5792,7 +5873,7 @@
|
|
|
5792
5873
|
}
|
|
5793
5874
|
set splitview(value) {
|
|
5794
5875
|
this._splitview = value;
|
|
5795
|
-
this.
|
|
5876
|
+
this._splitviewChangeDisposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
|
|
5796
5877
|
this._onDidLayoutChange.fire(undefined);
|
|
5797
5878
|
}), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
|
|
5798
5879
|
}
|
|
@@ -5814,7 +5895,7 @@
|
|
|
5814
5895
|
}
|
|
5815
5896
|
constructor(options) {
|
|
5816
5897
|
super(options.parentElement);
|
|
5817
|
-
this.
|
|
5898
|
+
this._splitviewChangeDisposable = new MutableDisposable();
|
|
5818
5899
|
this._panels = new Map();
|
|
5819
5900
|
this._onDidLayoutfromJSON = new Emitter();
|
|
5820
5901
|
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
@@ -5832,7 +5913,7 @@
|
|
|
5832
5913
|
options.frameworkComponents = {};
|
|
5833
5914
|
}
|
|
5834
5915
|
this.splitview = new Splitview(this.element, options);
|
|
5835
|
-
this.addDisposables(this.
|
|
5916
|
+
this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
|
|
5836
5917
|
}
|
|
5837
5918
|
updateOptions(options) {
|
|
5838
5919
|
const hasOrientationChanged = typeof options.orientation === 'string' &&
|
|
@@ -5870,15 +5951,15 @@
|
|
|
5870
5951
|
}
|
|
5871
5952
|
}
|
|
5872
5953
|
removePanel(panel, sizing) {
|
|
5873
|
-
const
|
|
5874
|
-
if (!
|
|
5954
|
+
const item = this._panels.get(panel.id);
|
|
5955
|
+
if (!item) {
|
|
5875
5956
|
throw new Error(`unknown splitview panel ${panel.id}`);
|
|
5876
5957
|
}
|
|
5877
|
-
|
|
5878
|
-
disposable.value.dispose();
|
|
5958
|
+
item.dispose();
|
|
5879
5959
|
this._panels.delete(panel.id);
|
|
5880
5960
|
const index = this.panels.findIndex((_) => _ === panel);
|
|
5881
|
-
this.splitview.removeView(index, sizing);
|
|
5961
|
+
const removedView = this.splitview.removeView(index, sizing);
|
|
5962
|
+
removedView.dispose();
|
|
5882
5963
|
const panels = this.panels;
|
|
5883
5964
|
if (panels.length > 0) {
|
|
5884
5965
|
this.setActive(panels[panels.length - 1]);
|
|
@@ -5925,7 +6006,7 @@
|
|
|
5925
6006
|
}
|
|
5926
6007
|
this.setActive(view, true);
|
|
5927
6008
|
});
|
|
5928
|
-
this._panels.set(view.id,
|
|
6009
|
+
this._panels.set(view.id, disposable);
|
|
5929
6010
|
}
|
|
5930
6011
|
toJSON() {
|
|
5931
6012
|
var _a;
|
|
@@ -5998,20 +6079,26 @@
|
|
|
5998
6079
|
this._onDidLayoutfromJSON.fire();
|
|
5999
6080
|
}
|
|
6000
6081
|
clear() {
|
|
6001
|
-
for (const
|
|
6002
|
-
|
|
6003
|
-
value.value.dispose();
|
|
6082
|
+
for (const disposable of this._panels.values()) {
|
|
6083
|
+
disposable.dispose();
|
|
6004
6084
|
}
|
|
6005
6085
|
this._panels.clear();
|
|
6006
|
-
this.splitview.
|
|
6086
|
+
while (this.splitview.length > 0) {
|
|
6087
|
+
const view = this.splitview.removeView(0, exports.Sizing.Distribute, true);
|
|
6088
|
+
view.dispose();
|
|
6089
|
+
}
|
|
6007
6090
|
}
|
|
6008
6091
|
dispose() {
|
|
6009
|
-
for (const
|
|
6010
|
-
|
|
6011
|
-
value.value.dispose();
|
|
6092
|
+
for (const disposable of this._panels.values()) {
|
|
6093
|
+
disposable.dispose();
|
|
6012
6094
|
}
|
|
6013
6095
|
this._panels.clear();
|
|
6096
|
+
const views = this.splitview.getViews();
|
|
6097
|
+
this._splitviewChangeDisposable.dispose();
|
|
6014
6098
|
this.splitview.dispose();
|
|
6099
|
+
for (const view of views) {
|
|
6100
|
+
view.dispose();
|
|
6101
|
+
}
|
|
6015
6102
|
super.dispose();
|
|
6016
6103
|
}
|
|
6017
6104
|
}
|