dockview-core 1.7.3 → 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.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 +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 +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 +280 -189
- 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 +280 -189
- package/dist/dockview-core.cjs.js +280 -189
- package/dist/dockview-core.esm.js +280 -189
- package/dist/dockview-core.esm.min.js +2 -2
- package/dist/dockview-core.js +280 -189
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.noStyle.js +280 -189
- 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 +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 +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
|
@@ -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
|
*/
|
|
@@ -95,9 +95,49 @@
|
|
|
95
95
|
};
|
|
96
96
|
};
|
|
97
97
|
})(exports.DockviewEvent || (exports.DockviewEvent = {}));
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
class LeakageMonitor {
|
|
99
|
+
constructor() {
|
|
100
|
+
this.events = new Map();
|
|
101
|
+
}
|
|
102
|
+
get size() {
|
|
103
|
+
return this.events.size;
|
|
104
|
+
}
|
|
105
|
+
add(event, stacktrace) {
|
|
106
|
+
this.events.set(event, stacktrace);
|
|
107
|
+
}
|
|
108
|
+
delete(event) {
|
|
109
|
+
this.events.delete(event);
|
|
110
|
+
}
|
|
111
|
+
clear() {
|
|
112
|
+
this.events.clear();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
class Stacktrace {
|
|
116
|
+
static create() {
|
|
117
|
+
var _a;
|
|
118
|
+
return new Stacktrace((_a = new Error().stack) !== null && _a !== void 0 ? _a : '');
|
|
119
|
+
}
|
|
120
|
+
constructor(value) {
|
|
121
|
+
this.value = value;
|
|
122
|
+
}
|
|
123
|
+
print() {
|
|
124
|
+
console.warn(this.value);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
class Listener {
|
|
128
|
+
constructor(callback, stacktrace) {
|
|
129
|
+
this.callback = callback;
|
|
130
|
+
this.stacktrace = stacktrace;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// relatively simple event emitter taken from https://github.com/microsoft/vscode/blob/master/src/vs/base/common/event.ts
|
|
100
134
|
class Emitter {
|
|
135
|
+
static setLeakageMonitorEnabled(isEnabled) {
|
|
136
|
+
if (isEnabled !== Emitter.ENABLE_TRACKING) {
|
|
137
|
+
Emitter.MEMORY_LEAK_WATCHER.clear();
|
|
138
|
+
}
|
|
139
|
+
Emitter.ENABLE_TRACKING = isEnabled;
|
|
140
|
+
}
|
|
101
141
|
constructor(options) {
|
|
102
142
|
this.options = options;
|
|
103
143
|
this._listeners = [];
|
|
@@ -105,11 +145,12 @@
|
|
|
105
145
|
}
|
|
106
146
|
get event() {
|
|
107
147
|
if (!this._event) {
|
|
108
|
-
this._event = (
|
|
148
|
+
this._event = (callback) => {
|
|
109
149
|
var _a;
|
|
110
150
|
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) && this._last !== undefined) {
|
|
111
|
-
|
|
151
|
+
callback(this._last);
|
|
112
152
|
}
|
|
153
|
+
const listener = new Listener(callback, Emitter.ENABLE_TRACKING ? Stacktrace.create() : undefined);
|
|
113
154
|
this._listeners.push(listener);
|
|
114
155
|
return {
|
|
115
156
|
dispose: () => {
|
|
@@ -117,23 +158,45 @@
|
|
|
117
158
|
if (index > -1) {
|
|
118
159
|
this._listeners.splice(index, 1);
|
|
119
160
|
}
|
|
161
|
+
else if (Emitter.ENABLE_TRACKING) ;
|
|
120
162
|
},
|
|
121
163
|
};
|
|
122
164
|
};
|
|
165
|
+
if (Emitter.ENABLE_TRACKING) {
|
|
166
|
+
Emitter.MEMORY_LEAK_WATCHER.add(this._event, Stacktrace.create());
|
|
167
|
+
}
|
|
123
168
|
}
|
|
124
169
|
return this._event;
|
|
125
170
|
}
|
|
126
171
|
fire(e) {
|
|
127
172
|
this._last = e;
|
|
128
173
|
for (const listener of this._listeners) {
|
|
129
|
-
listener(e);
|
|
174
|
+
listener.callback(e);
|
|
130
175
|
}
|
|
131
176
|
}
|
|
132
177
|
dispose() {
|
|
133
|
-
this.
|
|
134
|
-
|
|
178
|
+
if (!this._disposed) {
|
|
179
|
+
this._disposed = true;
|
|
180
|
+
if (this._listeners.length > 0) {
|
|
181
|
+
if (Emitter.ENABLE_TRACKING) {
|
|
182
|
+
queueMicrotask(() => {
|
|
183
|
+
var _a;
|
|
184
|
+
// don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block
|
|
185
|
+
for (const listener of this._listeners) {
|
|
186
|
+
console.warn((_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
this._listeners = [];
|
|
191
|
+
}
|
|
192
|
+
if (Emitter.ENABLE_TRACKING && this._event) {
|
|
193
|
+
Emitter.MEMORY_LEAK_WATCHER.delete(this._event);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
135
196
|
}
|
|
136
197
|
}
|
|
198
|
+
Emitter.ENABLE_TRACKING = false;
|
|
199
|
+
Emitter.MEMORY_LEAK_WATCHER = new LeakageMonitor();
|
|
137
200
|
function addDisposableWindowListener(element, type, listener, options) {
|
|
138
201
|
element.addEventListener(type, listener, options);
|
|
139
202
|
return {
|
|
@@ -186,13 +249,13 @@
|
|
|
186
249
|
}
|
|
187
250
|
constructor(...args) {
|
|
188
251
|
this._isDisposed = false;
|
|
189
|
-
this.
|
|
252
|
+
this._disposables = args;
|
|
190
253
|
}
|
|
191
254
|
addDisposables(...args) {
|
|
192
|
-
args.forEach((arg) => this.
|
|
255
|
+
args.forEach((arg) => this._disposables.push(arg));
|
|
193
256
|
}
|
|
194
257
|
dispose() {
|
|
195
|
-
this.
|
|
258
|
+
this._disposables.forEach((arg) => arg.dispose());
|
|
196
259
|
this._isDisposed = true;
|
|
197
260
|
}
|
|
198
261
|
}
|
|
@@ -282,6 +345,7 @@
|
|
|
282
345
|
this.onDidFocus = this._onDidFocus.event;
|
|
283
346
|
this._onDidBlur = new Emitter();
|
|
284
347
|
this.onDidBlur = this._onDidBlur.event;
|
|
348
|
+
this.addDisposables(this._onDidFocus, this._onDidBlur);
|
|
285
349
|
let hasFocus = isAncestor(document.activeElement, element);
|
|
286
350
|
let loosingFocus = false;
|
|
287
351
|
const onFocus = () => {
|
|
@@ -326,11 +390,6 @@
|
|
|
326
390
|
refreshState() {
|
|
327
391
|
this._refreshStateHandler();
|
|
328
392
|
}
|
|
329
|
-
dispose() {
|
|
330
|
-
super.dispose();
|
|
331
|
-
this._onDidBlur.dispose();
|
|
332
|
-
this._onDidFocus.dispose();
|
|
333
|
-
}
|
|
334
393
|
}
|
|
335
394
|
|
|
336
395
|
function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
|
|
@@ -559,7 +618,7 @@
|
|
|
559
618
|
this._orthogonalSize = value;
|
|
560
619
|
}
|
|
561
620
|
get length() {
|
|
562
|
-
return this.
|
|
621
|
+
return this.viewItems.length;
|
|
563
622
|
}
|
|
564
623
|
get proportions() {
|
|
565
624
|
return this._proportions ? [...this._proportions] : undefined;
|
|
@@ -578,12 +637,12 @@
|
|
|
578
637
|
: 'vertical');
|
|
579
638
|
}
|
|
580
639
|
get minimumSize() {
|
|
581
|
-
return this.
|
|
640
|
+
return this.viewItems.reduce((r, item) => r + item.minimumSize, 0);
|
|
582
641
|
}
|
|
583
642
|
get maximumSize() {
|
|
584
643
|
return this.length === 0
|
|
585
644
|
? Number.POSITIVE_INFINITY
|
|
586
|
-
: this.
|
|
645
|
+
: this.viewItems.reduce((r, item) => r + item.maximumSize, 0);
|
|
587
646
|
}
|
|
588
647
|
get startSnappingEnabled() {
|
|
589
648
|
return this._startSnappingEnabled;
|
|
@@ -607,7 +666,7 @@
|
|
|
607
666
|
}
|
|
608
667
|
constructor(container, options) {
|
|
609
668
|
this.container = container;
|
|
610
|
-
this.
|
|
669
|
+
this.viewItems = [];
|
|
611
670
|
this.sashes = [];
|
|
612
671
|
this._size = 0;
|
|
613
672
|
this._orthogonalSize = 0;
|
|
@@ -621,12 +680,12 @@
|
|
|
621
680
|
this.onDidAddView = this._onDidAddView.event;
|
|
622
681
|
this._onDidRemoveView = new Emitter();
|
|
623
682
|
this.onDidRemoveView = this._onDidRemoveView.event;
|
|
624
|
-
this.resize = (index, delta, sizes = this.
|
|
625
|
-
if (index < 0 || index > this.
|
|
683
|
+
this.resize = (index, delta, sizes = this.viewItems.map((x) => x.size), lowPriorityIndexes, highPriorityIndexes, overloadMinDelta = Number.NEGATIVE_INFINITY, overloadMaxDelta = Number.POSITIVE_INFINITY, snapBefore, snapAfter) => {
|
|
684
|
+
if (index < 0 || index > this.viewItems.length) {
|
|
626
685
|
return 0;
|
|
627
686
|
}
|
|
628
687
|
const upIndexes = range(index, -1);
|
|
629
|
-
const downIndexes = range(index + 1, this.
|
|
688
|
+
const downIndexes = range(index + 1, this.viewItems.length);
|
|
630
689
|
//
|
|
631
690
|
if (highPriorityIndexes) {
|
|
632
691
|
for (const i of highPriorityIndexes) {
|
|
@@ -641,34 +700,34 @@
|
|
|
641
700
|
}
|
|
642
701
|
}
|
|
643
702
|
//
|
|
644
|
-
const upItems = upIndexes.map((i) => this.
|
|
703
|
+
const upItems = upIndexes.map((i) => this.viewItems[i]);
|
|
645
704
|
const upSizes = upIndexes.map((i) => sizes[i]);
|
|
646
705
|
//
|
|
647
|
-
const downItems = downIndexes.map((i) => this.
|
|
706
|
+
const downItems = downIndexes.map((i) => this.viewItems[i]);
|
|
648
707
|
const downSizes = downIndexes.map((i) => sizes[i]);
|
|
649
708
|
//
|
|
650
|
-
const minDeltaUp = upIndexes.reduce((_, i) => _ + this.
|
|
651
|
-
const maxDeltaUp = upIndexes.reduce((_, i) => _ + this.
|
|
709
|
+
const minDeltaUp = upIndexes.reduce((_, i) => _ + this.viewItems[i].minimumSize - sizes[i], 0);
|
|
710
|
+
const maxDeltaUp = upIndexes.reduce((_, i) => _ + this.viewItems[i].maximumSize - sizes[i], 0);
|
|
652
711
|
//
|
|
653
712
|
const maxDeltaDown = downIndexes.length === 0
|
|
654
713
|
? Number.POSITIVE_INFINITY
|
|
655
|
-
: downIndexes.reduce((_, i) => _ + sizes[i] - this.
|
|
714
|
+
: downIndexes.reduce((_, i) => _ + sizes[i] - this.viewItems[i].minimumSize, 0);
|
|
656
715
|
const minDeltaDown = downIndexes.length === 0
|
|
657
716
|
? Number.NEGATIVE_INFINITY
|
|
658
|
-
: downIndexes.reduce((_, i) => _ + sizes[i] - this.
|
|
717
|
+
: downIndexes.reduce((_, i) => _ + sizes[i] - this.viewItems[i].maximumSize, 0);
|
|
659
718
|
//
|
|
660
719
|
const minDelta = Math.max(minDeltaUp, minDeltaDown);
|
|
661
720
|
const maxDelta = Math.min(maxDeltaDown, maxDeltaUp);
|
|
662
721
|
//
|
|
663
722
|
let snapped = false;
|
|
664
723
|
if (snapBefore) {
|
|
665
|
-
const snapView = this.
|
|
724
|
+
const snapView = this.viewItems[snapBefore.index];
|
|
666
725
|
const visible = delta >= snapBefore.limitDelta;
|
|
667
726
|
snapped = visible !== snapView.visible;
|
|
668
727
|
snapView.setVisible(visible, snapBefore.size);
|
|
669
728
|
}
|
|
670
729
|
if (!snapped && snapAfter) {
|
|
671
|
-
const snapView = this.
|
|
730
|
+
const snapView = this.viewItems[snapAfter.index];
|
|
672
731
|
const visible = delta < snapAfter.limitDelta;
|
|
673
732
|
snapped = visible !== snapView.visible;
|
|
674
733
|
snapView.setVisible(visible, snapAfter.size);
|
|
@@ -730,7 +789,7 @@
|
|
|
730
789
|
);
|
|
731
790
|
});
|
|
732
791
|
// Initialize content size and proportions for first layout
|
|
733
|
-
this.contentSize = this.
|
|
792
|
+
this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
734
793
|
this.saveProportions();
|
|
735
794
|
}
|
|
736
795
|
}
|
|
@@ -747,18 +806,18 @@
|
|
|
747
806
|
}
|
|
748
807
|
}
|
|
749
808
|
isViewVisible(index) {
|
|
750
|
-
if (index < 0 || index >= this.
|
|
809
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
751
810
|
throw new Error('Index out of bounds');
|
|
752
811
|
}
|
|
753
|
-
const viewItem = this.
|
|
812
|
+
const viewItem = this.viewItems[index];
|
|
754
813
|
return viewItem.visible;
|
|
755
814
|
}
|
|
756
815
|
setViewVisible(index, visible) {
|
|
757
|
-
if (index < 0 || index >= this.
|
|
816
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
758
817
|
throw new Error('Index out of bounds');
|
|
759
818
|
}
|
|
760
819
|
toggleClass(this.container, 'visible', visible);
|
|
761
|
-
const viewItem = this.
|
|
820
|
+
const viewItem = this.viewItems[index];
|
|
762
821
|
toggleClass(this.container, 'visible', visible);
|
|
763
822
|
viewItem.setVisible(visible, viewItem.size);
|
|
764
823
|
this.distributeEmptySpace(index);
|
|
@@ -766,33 +825,33 @@
|
|
|
766
825
|
this.saveProportions();
|
|
767
826
|
}
|
|
768
827
|
getViewSize(index) {
|
|
769
|
-
if (index < 0 || index >= this.
|
|
828
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
770
829
|
return -1;
|
|
771
830
|
}
|
|
772
|
-
return this.
|
|
831
|
+
return this.viewItems[index].size;
|
|
773
832
|
}
|
|
774
833
|
resizeView(index, size) {
|
|
775
|
-
if (index < 0 || index >= this.
|
|
834
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
776
835
|
return;
|
|
777
836
|
}
|
|
778
|
-
const indexes = range(this.
|
|
837
|
+
const indexes = range(this.viewItems.length).filter((i) => i !== index);
|
|
779
838
|
const lowPriorityIndexes = [
|
|
780
|
-
...indexes.filter((i) => this.
|
|
839
|
+
...indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low),
|
|
781
840
|
index,
|
|
782
841
|
];
|
|
783
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
784
|
-
const item = this.
|
|
842
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
843
|
+
const item = this.viewItems[index];
|
|
785
844
|
size = Math.round(size);
|
|
786
845
|
size = clamp(size, item.minimumSize, Math.min(item.maximumSize, this._size));
|
|
787
846
|
item.size = size;
|
|
788
847
|
this.relayout(lowPriorityIndexes, highPriorityIndexes);
|
|
789
848
|
}
|
|
790
849
|
getViews() {
|
|
791
|
-
return this.
|
|
850
|
+
return this.viewItems.map((x) => x.view);
|
|
792
851
|
}
|
|
793
852
|
onDidChange(item, size) {
|
|
794
|
-
const index = this.
|
|
795
|
-
if (index < 0 || index >= this.
|
|
853
|
+
const index = this.viewItems.indexOf(item);
|
|
854
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
796
855
|
return;
|
|
797
856
|
}
|
|
798
857
|
size = typeof size === 'number' ? size : item.size;
|
|
@@ -800,7 +859,7 @@
|
|
|
800
859
|
item.size = size;
|
|
801
860
|
this.relayout([index]);
|
|
802
861
|
}
|
|
803
|
-
addView(view, size = { type: 'distribute' }, index = this.
|
|
862
|
+
addView(view, size = { type: 'distribute' }, index = this.viewItems.length, skipLayout) {
|
|
804
863
|
const container = document.createElement('div');
|
|
805
864
|
container.className = 'view';
|
|
806
865
|
container.appendChild(view.element);
|
|
@@ -818,24 +877,25 @@
|
|
|
818
877
|
viewSize = view.minimumSize;
|
|
819
878
|
}
|
|
820
879
|
const disposable = view.onDidChange((newSize) => this.onDidChange(viewItem, newSize.size));
|
|
821
|
-
const
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
880
|
+
const viewItem = new ViewItem(container, view, viewSize, {
|
|
881
|
+
dispose: () => {
|
|
882
|
+
disposable.dispose();
|
|
883
|
+
this.viewContainer.removeChild(container);
|
|
884
|
+
},
|
|
885
|
+
});
|
|
886
|
+
if (index === this.viewItems.length) {
|
|
827
887
|
this.viewContainer.appendChild(container);
|
|
828
888
|
}
|
|
829
889
|
else {
|
|
830
890
|
this.viewContainer.insertBefore(container, this.viewContainer.children.item(index));
|
|
831
891
|
}
|
|
832
|
-
this.
|
|
833
|
-
if (this.
|
|
892
|
+
this.viewItems.splice(index, 0, viewItem);
|
|
893
|
+
if (this.viewItems.length > 1) {
|
|
834
894
|
//add sash
|
|
835
895
|
const sash = document.createElement('div');
|
|
836
896
|
sash.className = 'sash';
|
|
837
897
|
const onStart = (event) => {
|
|
838
|
-
for (const item of this.
|
|
898
|
+
for (const item of this.viewItems) {
|
|
839
899
|
item.enabled = false;
|
|
840
900
|
}
|
|
841
901
|
const iframes = [
|
|
@@ -850,27 +910,29 @@
|
|
|
850
910
|
: event.clientY;
|
|
851
911
|
const sashIndex = firstIndex(this.sashes, (s) => s.container === sash);
|
|
852
912
|
//
|
|
853
|
-
const sizes = this.
|
|
913
|
+
const sizes = this.viewItems.map((x) => x.size);
|
|
854
914
|
//
|
|
855
915
|
let snapBefore;
|
|
856
916
|
let snapAfter;
|
|
857
917
|
const upIndexes = range(sashIndex, -1);
|
|
858
|
-
const downIndexes = range(sashIndex + 1, this.
|
|
859
|
-
const minDeltaUp = upIndexes.reduce((r, i) => r + (this.
|
|
860
|
-
const maxDeltaUp = upIndexes.reduce((r, i) => r + (this.
|
|
918
|
+
const downIndexes = range(sashIndex + 1, this.viewItems.length);
|
|
919
|
+
const minDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].minimumSize - sizes[i]), 0);
|
|
920
|
+
const maxDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].viewMaximumSize - sizes[i]), 0);
|
|
861
921
|
const maxDeltaDown = downIndexes.length === 0
|
|
862
922
|
? Number.POSITIVE_INFINITY
|
|
863
|
-
: downIndexes.reduce((r, i) => r +
|
|
923
|
+
: downIndexes.reduce((r, i) => r +
|
|
924
|
+
(sizes[i] - this.viewItems[i].minimumSize), 0);
|
|
864
925
|
const minDeltaDown = downIndexes.length === 0
|
|
865
926
|
? Number.NEGATIVE_INFINITY
|
|
866
927
|
: downIndexes.reduce((r, i) => r +
|
|
867
|
-
(sizes[i] -
|
|
928
|
+
(sizes[i] -
|
|
929
|
+
this.viewItems[i].viewMaximumSize), 0);
|
|
868
930
|
const minDelta = Math.max(minDeltaUp, minDeltaDown);
|
|
869
931
|
const maxDelta = Math.min(maxDeltaDown, maxDeltaUp);
|
|
870
932
|
const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);
|
|
871
933
|
const snapAfterIndex = this.findFirstSnapIndex(downIndexes);
|
|
872
934
|
if (typeof snapBeforeIndex === 'number') {
|
|
873
|
-
const snappedViewItem = this.
|
|
935
|
+
const snappedViewItem = this.viewItems[snapBeforeIndex];
|
|
874
936
|
const halfSize = Math.floor(snappedViewItem.viewMinimumSize / 2);
|
|
875
937
|
snapBefore = {
|
|
876
938
|
index: snapBeforeIndex,
|
|
@@ -881,7 +943,7 @@
|
|
|
881
943
|
};
|
|
882
944
|
}
|
|
883
945
|
if (typeof snapAfterIndex === 'number') {
|
|
884
|
-
const snappedViewItem = this.
|
|
946
|
+
const snappedViewItem = this.viewItems[snapAfterIndex];
|
|
885
947
|
const halfSize = Math.floor(snappedViewItem.viewMinimumSize / 2);
|
|
886
948
|
snapAfter = {
|
|
887
949
|
index: snapAfterIndex,
|
|
@@ -902,7 +964,7 @@
|
|
|
902
964
|
this.layoutViews();
|
|
903
965
|
};
|
|
904
966
|
const end = () => {
|
|
905
|
-
for (const item of this.
|
|
967
|
+
for (const item of this.viewItems) {
|
|
906
968
|
item.enabled = true;
|
|
907
969
|
}
|
|
908
970
|
for (const iframe of iframes) {
|
|
@@ -942,7 +1004,7 @@
|
|
|
942
1004
|
distributeViewSizes() {
|
|
943
1005
|
const flexibleViewItems = [];
|
|
944
1006
|
let flexibleSize = 0;
|
|
945
|
-
for (const item of this.
|
|
1007
|
+
for (const item of this.viewItems) {
|
|
946
1008
|
if (item.maximumSize - item.minimumSize > 0) {
|
|
947
1009
|
flexibleViewItems.push(item);
|
|
948
1010
|
flexibleSize += item.size;
|
|
@@ -952,17 +1014,17 @@
|
|
|
952
1014
|
for (const item of flexibleViewItems) {
|
|
953
1015
|
item.size = clamp(size, item.minimumSize, item.maximumSize);
|
|
954
1016
|
}
|
|
955
|
-
const indexes = range(this.
|
|
956
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
957
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1017
|
+
const indexes = range(this.viewItems.length);
|
|
1018
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1019
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
958
1020
|
this.relayout(lowPriorityIndexes, highPriorityIndexes);
|
|
959
1021
|
}
|
|
960
1022
|
removeView(index, sizing, skipLayout = false) {
|
|
961
1023
|
// Remove view
|
|
962
|
-
const viewItem = this.
|
|
1024
|
+
const viewItem = this.viewItems.splice(index, 1)[0];
|
|
963
1025
|
viewItem.dispose();
|
|
964
1026
|
// Remove sash
|
|
965
|
-
if (this.
|
|
1027
|
+
if (this.viewItems.length >= 1) {
|
|
966
1028
|
const sashIndex = Math.max(index - 1, 0);
|
|
967
1029
|
const sashItem = this.sashes.splice(sashIndex, 1)[0];
|
|
968
1030
|
sashItem.disposable();
|
|
@@ -977,10 +1039,10 @@
|
|
|
977
1039
|
return viewItem.view;
|
|
978
1040
|
}
|
|
979
1041
|
getViewCachedVisibleSize(index) {
|
|
980
|
-
if (index < 0 || index >= this.
|
|
1042
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
981
1043
|
throw new Error('Index out of bounds');
|
|
982
1044
|
}
|
|
983
|
-
const viewItem = this.
|
|
1045
|
+
const viewItem = this.viewItems[index];
|
|
984
1046
|
return viewItem.cachedVisibleSize;
|
|
985
1047
|
}
|
|
986
1048
|
moveView(from, to) {
|
|
@@ -996,14 +1058,14 @@
|
|
|
996
1058
|
this.size = size;
|
|
997
1059
|
this.orthogonalSize = orthogonalSize;
|
|
998
1060
|
if (!this.proportions) {
|
|
999
|
-
const indexes = range(this.
|
|
1000
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
1001
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1002
|
-
this.resize(this.
|
|
1061
|
+
const indexes = range(this.viewItems.length);
|
|
1062
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1063
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1064
|
+
this.resize(this.viewItems.length - 1, size - previousSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
1003
1065
|
}
|
|
1004
1066
|
else {
|
|
1005
|
-
for (let i = 0; i < this.
|
|
1006
|
-
const item = this.
|
|
1067
|
+
for (let i = 0; i < this.viewItems.length; i++) {
|
|
1068
|
+
const item = this.viewItems[i];
|
|
1007
1069
|
item.size = clamp(Math.round(this.proportions[i] * size), item.minimumSize, item.maximumSize);
|
|
1008
1070
|
}
|
|
1009
1071
|
}
|
|
@@ -1011,18 +1073,18 @@
|
|
|
1011
1073
|
this.layoutViews();
|
|
1012
1074
|
}
|
|
1013
1075
|
relayout(lowPriorityIndexes, highPriorityIndexes) {
|
|
1014
|
-
const contentSize = this.
|
|
1015
|
-
this.resize(this.
|
|
1076
|
+
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1077
|
+
this.resize(this.viewItems.length - 1, this._size - contentSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
1016
1078
|
this.distributeEmptySpace();
|
|
1017
1079
|
this.layoutViews();
|
|
1018
1080
|
this.saveProportions();
|
|
1019
1081
|
}
|
|
1020
1082
|
distributeEmptySpace(lowPriorityIndex) {
|
|
1021
|
-
const contentSize = this.
|
|
1083
|
+
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1022
1084
|
let emptyDelta = this.size - contentSize;
|
|
1023
|
-
const indexes = range(this.
|
|
1024
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
1025
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1085
|
+
const indexes = range(this.viewItems.length - 1, -1);
|
|
1086
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1087
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1026
1088
|
for (const index of highPriorityIndexes) {
|
|
1027
1089
|
pushToStart(indexes, index);
|
|
1028
1090
|
}
|
|
@@ -1033,7 +1095,7 @@
|
|
|
1033
1095
|
pushToEnd(indexes, lowPriorityIndex);
|
|
1034
1096
|
}
|
|
1035
1097
|
for (let i = 0; emptyDelta !== 0 && i < indexes.length; i++) {
|
|
1036
|
-
const item = this.
|
|
1098
|
+
const item = this.viewItems[indexes[i]];
|
|
1037
1099
|
const size = clamp(item.size + emptyDelta, item.minimumSize, item.maximumSize);
|
|
1038
1100
|
const viewDelta = size - item.size;
|
|
1039
1101
|
emptyDelta -= viewDelta;
|
|
@@ -1042,16 +1104,16 @@
|
|
|
1042
1104
|
}
|
|
1043
1105
|
saveProportions() {
|
|
1044
1106
|
if (this.proportionalLayout && this.contentSize > 0) {
|
|
1045
|
-
this._proportions = this.
|
|
1107
|
+
this._proportions = this.viewItems.map((i) => i.size / this.contentSize);
|
|
1046
1108
|
}
|
|
1047
1109
|
}
|
|
1048
1110
|
layoutViews() {
|
|
1049
|
-
this.contentSize = this.
|
|
1111
|
+
this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1050
1112
|
let sum = 0;
|
|
1051
1113
|
const x = [];
|
|
1052
1114
|
this.updateSashEnablement();
|
|
1053
|
-
for (let i = 0; i < this.
|
|
1054
|
-
sum += this.
|
|
1115
|
+
for (let i = 0; i < this.viewItems.length - 1; i++) {
|
|
1116
|
+
sum += this.viewItems[i].size;
|
|
1055
1117
|
x.push(sum);
|
|
1056
1118
|
const offset = Math.min(Math.max(0, sum - 2), this.size - 4);
|
|
1057
1119
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
@@ -1063,7 +1125,7 @@
|
|
|
1063
1125
|
this.sashes[i].container.style.top = `${offset}px`;
|
|
1064
1126
|
}
|
|
1065
1127
|
}
|
|
1066
|
-
this.
|
|
1128
|
+
this.viewItems.forEach((view, i) => {
|
|
1067
1129
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
1068
1130
|
view.container.style.width = `${view.size}px`;
|
|
1069
1131
|
view.container.style.left = i == 0 ? '0px' : `${x[i - 1]}px`;
|
|
@@ -1082,7 +1144,7 @@
|
|
|
1082
1144
|
findFirstSnapIndex(indexes) {
|
|
1083
1145
|
// visible views first
|
|
1084
1146
|
for (const index of indexes) {
|
|
1085
|
-
const viewItem = this.
|
|
1147
|
+
const viewItem = this.viewItems[index];
|
|
1086
1148
|
if (!viewItem.visible) {
|
|
1087
1149
|
continue;
|
|
1088
1150
|
}
|
|
@@ -1092,7 +1154,7 @@
|
|
|
1092
1154
|
}
|
|
1093
1155
|
// then, hidden views
|
|
1094
1156
|
for (const index of indexes) {
|
|
1095
|
-
const viewItem = this.
|
|
1157
|
+
const viewItem = this.viewItems[index];
|
|
1096
1158
|
if (viewItem.visible &&
|
|
1097
1159
|
viewItem.maximumSize - viewItem.minimumSize > 0) {
|
|
1098
1160
|
return undefined;
|
|
@@ -1105,10 +1167,10 @@
|
|
|
1105
1167
|
}
|
|
1106
1168
|
updateSashEnablement() {
|
|
1107
1169
|
let previous = false;
|
|
1108
|
-
const collapsesDown = this.
|
|
1170
|
+
const collapsesDown = this.viewItems.map((i) => (previous = i.size - i.minimumSize > 0 || previous));
|
|
1109
1171
|
previous = false;
|
|
1110
|
-
const expandsDown = this.
|
|
1111
|
-
const reverseViews = [...this.
|
|
1172
|
+
const expandsDown = this.viewItems.map((i) => (previous = i.maximumSize - i.size > 0 || previous));
|
|
1173
|
+
const reverseViews = [...this.viewItems].reverse();
|
|
1112
1174
|
previous = false;
|
|
1113
1175
|
const collapsesUp = reverseViews
|
|
1114
1176
|
.map((i) => (previous = i.size - i.minimumSize > 0 || previous))
|
|
@@ -1120,19 +1182,19 @@
|
|
|
1120
1182
|
let position = 0;
|
|
1121
1183
|
for (let index = 0; index < this.sashes.length; index++) {
|
|
1122
1184
|
const sash = this.sashes[index];
|
|
1123
|
-
const viewItem = this.
|
|
1185
|
+
const viewItem = this.viewItems[index];
|
|
1124
1186
|
position += viewItem.size;
|
|
1125
1187
|
const min = !(collapsesDown[index] && expandsUp[index + 1]);
|
|
1126
1188
|
const max = !(expandsDown[index] && collapsesUp[index + 1]);
|
|
1127
1189
|
if (min && max) {
|
|
1128
1190
|
const upIndexes = range(index, -1);
|
|
1129
|
-
const downIndexes = range(index + 1, this.
|
|
1191
|
+
const downIndexes = range(index + 1, this.viewItems.length);
|
|
1130
1192
|
const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);
|
|
1131
1193
|
const snapAfterIndex = this.findFirstSnapIndex(downIndexes);
|
|
1132
1194
|
const snappedBefore = typeof snapBeforeIndex === 'number' &&
|
|
1133
|
-
!this.
|
|
1195
|
+
!this.viewItems[snapBeforeIndex].visible;
|
|
1134
1196
|
const snappedAfter = typeof snapAfterIndex === 'number' &&
|
|
1135
|
-
!this.
|
|
1197
|
+
!this.viewItems[snapAfterIndex].visible;
|
|
1136
1198
|
if (snappedBefore &&
|
|
1137
1199
|
collapsesUp[index] &&
|
|
1138
1200
|
(position > 0 || this.startSnappingEnabled)) {
|
|
@@ -1192,6 +1254,9 @@
|
|
|
1192
1254
|
break;
|
|
1193
1255
|
}
|
|
1194
1256
|
}
|
|
1257
|
+
for (const viewItem of this.viewItems) {
|
|
1258
|
+
viewItem.dispose();
|
|
1259
|
+
}
|
|
1195
1260
|
this.element.remove();
|
|
1196
1261
|
}
|
|
1197
1262
|
}
|
|
@@ -1626,7 +1691,7 @@
|
|
|
1626
1691
|
throw new Error('Invalid index');
|
|
1627
1692
|
}
|
|
1628
1693
|
this.splitview.removeView(index, sizing);
|
|
1629
|
-
this._removeChild(index);
|
|
1694
|
+
return this._removeChild(index);
|
|
1630
1695
|
}
|
|
1631
1696
|
_addChild(node, index) {
|
|
1632
1697
|
this.children.splice(index, 0, node);
|
|
@@ -1648,10 +1713,10 @@
|
|
|
1648
1713
|
});
|
|
1649
1714
|
}
|
|
1650
1715
|
dispose() {
|
|
1651
|
-
super.dispose();
|
|
1652
1716
|
this._childrenDisposable.dispose();
|
|
1653
|
-
this.children.forEach((child) => child.dispose());
|
|
1654
1717
|
this.splitview.dispose();
|
|
1718
|
+
this.children.forEach((child) => child.dispose());
|
|
1719
|
+
super.dispose();
|
|
1655
1720
|
}
|
|
1656
1721
|
}
|
|
1657
1722
|
|
|
@@ -1881,7 +1946,8 @@
|
|
|
1881
1946
|
if (oldRoot.children.length === 1) {
|
|
1882
1947
|
// can remove one level of redundant branching if there is only a single child
|
|
1883
1948
|
const childReference = oldRoot.children[0];
|
|
1884
|
-
oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
1949
|
+
const child = oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
1950
|
+
child.dispose();
|
|
1885
1951
|
oldRoot.dispose();
|
|
1886
1952
|
this._root.addChild(
|
|
1887
1953
|
/**
|
|
@@ -1988,7 +2054,8 @@
|
|
|
1988
2054
|
if (typeof newSiblingCachedVisibleSize === 'number') {
|
|
1989
2055
|
newSiblingSize = exports.Sizing.Invisible(newSiblingCachedVisibleSize);
|
|
1990
2056
|
}
|
|
1991
|
-
grandParent.removeChild(parentIndex);
|
|
2057
|
+
const child = grandParent.removeChild(parentIndex);
|
|
2058
|
+
child.dispose();
|
|
1992
2059
|
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize);
|
|
1993
2060
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
1994
2061
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
@@ -2014,30 +2081,36 @@
|
|
|
2014
2081
|
if (!(node instanceof LeafNode)) {
|
|
2015
2082
|
throw new Error('Invalid location');
|
|
2016
2083
|
}
|
|
2017
|
-
|
|
2084
|
+
const view = node.view;
|
|
2085
|
+
node.dispose(); // dispose of node
|
|
2086
|
+
const child = parent.removeChild(index, sizing);
|
|
2087
|
+
child.dispose();
|
|
2018
2088
|
if (parent.children.length === 0) {
|
|
2019
|
-
return
|
|
2089
|
+
return view;
|
|
2020
2090
|
}
|
|
2021
2091
|
if (parent.children.length > 1) {
|
|
2022
|
-
return
|
|
2092
|
+
return view;
|
|
2023
2093
|
}
|
|
2024
2094
|
const sibling = parent.children[0];
|
|
2025
2095
|
if (pathToParent.length === 0) {
|
|
2026
2096
|
// parent is root
|
|
2027
2097
|
if (sibling instanceof LeafNode) {
|
|
2028
|
-
return
|
|
2098
|
+
return view;
|
|
2029
2099
|
}
|
|
2030
2100
|
// we must promote sibling to be the new root
|
|
2031
|
-
parent.removeChild(0, sizing);
|
|
2101
|
+
const child = parent.removeChild(0, sizing);
|
|
2102
|
+
child.dispose();
|
|
2032
2103
|
this.root = sibling;
|
|
2033
|
-
return
|
|
2104
|
+
return view;
|
|
2034
2105
|
}
|
|
2035
2106
|
const [grandParent, ..._] = [...pathToParent].reverse();
|
|
2036
2107
|
const [parentIndex, ...__] = [...rest].reverse();
|
|
2037
2108
|
const isSiblingVisible = parent.isChildVisible(0);
|
|
2038
|
-
parent.removeChild(0, sizing);
|
|
2109
|
+
const childNode = parent.removeChild(0, sizing);
|
|
2110
|
+
childNode.dispose();
|
|
2039
2111
|
const sizes = grandParent.children.map((_size, i) => grandParent.getChildSize(i));
|
|
2040
|
-
grandParent.removeChild(parentIndex, sizing);
|
|
2112
|
+
const parentNode = grandParent.removeChild(parentIndex, sizing);
|
|
2113
|
+
parentNode.dispose();
|
|
2041
2114
|
if (sibling instanceof BranchNode) {
|
|
2042
2115
|
sizes.splice(parentIndex, 1, ...sibling.children.map((c) => c.size));
|
|
2043
2116
|
for (let i = 0; i < sibling.children.length; i++) {
|
|
@@ -2055,7 +2128,7 @@
|
|
|
2055
2128
|
for (let i = 0; i < sizes.length; i++) {
|
|
2056
2129
|
grandParent.resizeChild(i, sizes[i]);
|
|
2057
2130
|
}
|
|
2058
|
-
return
|
|
2131
|
+
return view;
|
|
2059
2132
|
}
|
|
2060
2133
|
layout(width, height) {
|
|
2061
2134
|
const [size, orthogonalSize] = this.root.orientation === exports.Orientation.HORIZONTAL
|
|
@@ -2550,6 +2623,7 @@
|
|
|
2550
2623
|
}
|
|
2551
2624
|
dispose() {
|
|
2552
2625
|
this.removeDropTarget();
|
|
2626
|
+
super.dispose();
|
|
2553
2627
|
}
|
|
2554
2628
|
toggleClasses(quadrant, width, height) {
|
|
2555
2629
|
var _a, _b, _c, _d;
|
|
@@ -2727,8 +2801,8 @@
|
|
|
2727
2801
|
if (this.panel.view) {
|
|
2728
2802
|
const _onDidFocus = this.panel.view.content.onDidFocus;
|
|
2729
2803
|
const _onDidBlur = this.panel.view.content.onDidBlur;
|
|
2730
|
-
const
|
|
2731
|
-
disposable.addDisposables(onDidFocus(() => this._onDidFocus.fire()), onDidBlur(() => this._onDidBlur.fire()));
|
|
2804
|
+
const focusTracker = trackFocus(this._element);
|
|
2805
|
+
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
|
|
2732
2806
|
if (_onDidFocus) {
|
|
2733
2807
|
disposable.addDisposables(_onDidFocus(() => this._onDidFocus.fire()));
|
|
2734
2808
|
}
|
|
@@ -2771,6 +2845,7 @@
|
|
|
2771
2845
|
this._onDragStart = new Emitter();
|
|
2772
2846
|
this.onDragStart = this._onDragStart.event;
|
|
2773
2847
|
this.iframes = [];
|
|
2848
|
+
this.addDisposables(this._onDragStart);
|
|
2774
2849
|
this.configure();
|
|
2775
2850
|
}
|
|
2776
2851
|
configure() {
|
|
@@ -2821,13 +2896,12 @@
|
|
|
2821
2896
|
this.onChanged = this._onChanged.event;
|
|
2822
2897
|
this._onDropped = new Emitter();
|
|
2823
2898
|
this.onDrop = this._onDropped.event;
|
|
2824
|
-
this.addDisposables(this._onChanged, this._onDropped);
|
|
2825
2899
|
this._element = document.createElement('div');
|
|
2826
2900
|
this._element.className = 'tab';
|
|
2827
2901
|
this._element.tabIndex = 0;
|
|
2828
2902
|
this._element.draggable = true;
|
|
2829
2903
|
toggleClass(this.element, 'inactive-tab', true);
|
|
2830
|
-
this.addDisposables(new (class Handler extends DragHandler {
|
|
2904
|
+
this.addDisposables(this._onChanged, this._onDropped, new (class Handler extends DragHandler {
|
|
2831
2905
|
constructor() {
|
|
2832
2906
|
super(...arguments);
|
|
2833
2907
|
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
@@ -2840,9 +2914,6 @@
|
|
|
2840
2914
|
},
|
|
2841
2915
|
};
|
|
2842
2916
|
}
|
|
2843
|
-
dispose() {
|
|
2844
|
-
//
|
|
2845
|
-
}
|
|
2846
2917
|
})(this._element));
|
|
2847
2918
|
this.addDisposables(addDisposableListener(this._element, 'mousedown', (event) => {
|
|
2848
2919
|
if (event.defaultPrevented) {
|
|
@@ -2877,7 +2948,7 @@
|
|
|
2877
2948
|
});
|
|
2878
2949
|
this.addDisposables(this.droptarget.onDrop((event) => {
|
|
2879
2950
|
this._onDropped.fire(event);
|
|
2880
|
-
}));
|
|
2951
|
+
}), this.droptarget);
|
|
2881
2952
|
}
|
|
2882
2953
|
setActive(isActive) {
|
|
2883
2954
|
toggleClass(this.element, 'active-tab', isActive);
|
|
@@ -2892,7 +2963,6 @@
|
|
|
2892
2963
|
}
|
|
2893
2964
|
dispose() {
|
|
2894
2965
|
super.dispose();
|
|
2895
|
-
this.droptarget.dispose();
|
|
2896
2966
|
}
|
|
2897
2967
|
}
|
|
2898
2968
|
|
|
@@ -2938,9 +3008,6 @@
|
|
|
2938
3008
|
},
|
|
2939
3009
|
};
|
|
2940
3010
|
}
|
|
2941
|
-
dispose() {
|
|
2942
|
-
//
|
|
2943
|
-
}
|
|
2944
3011
|
}
|
|
2945
3012
|
|
|
2946
3013
|
class VoidContainer extends CompositeDisposable {
|
|
@@ -3096,6 +3163,7 @@
|
|
|
3096
3163
|
const tabToRemove = this.tabs.splice(index, 1)[0];
|
|
3097
3164
|
const { value, disposable } = tabToRemove;
|
|
3098
3165
|
disposable.dispose();
|
|
3166
|
+
value.dispose();
|
|
3099
3167
|
value.element.remove();
|
|
3100
3168
|
}
|
|
3101
3169
|
setActivePanel(panel) {
|
|
@@ -3139,9 +3207,10 @@
|
|
|
3139
3207
|
}
|
|
3140
3208
|
dispose() {
|
|
3141
3209
|
super.dispose();
|
|
3142
|
-
this.tabs
|
|
3143
|
-
|
|
3144
|
-
|
|
3210
|
+
for (const { value, disposable } of this.tabs) {
|
|
3211
|
+
disposable.dispose();
|
|
3212
|
+
value.dispose();
|
|
3213
|
+
}
|
|
3145
3214
|
this.tabs = [];
|
|
3146
3215
|
}
|
|
3147
3216
|
}
|
|
@@ -3239,7 +3308,7 @@
|
|
|
3239
3308
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
3240
3309
|
this.header.hidden = !!options.hideHeader;
|
|
3241
3310
|
this.locked = !!options.locked;
|
|
3242
|
-
this.addDisposables(this.
|
|
3311
|
+
this.addDisposables(this.tabsContainer.onDrop((event) => {
|
|
3243
3312
|
this.handleDropEvent(event.event, 'center', event.index);
|
|
3244
3313
|
}), this.contentContainer.onDidFocus(() => {
|
|
3245
3314
|
this.accessor.doSetGroupActive(this.groupPanel, true);
|
|
@@ -3247,7 +3316,7 @@
|
|
|
3247
3316
|
// noop
|
|
3248
3317
|
}), this.dropTarget.onDrop((event) => {
|
|
3249
3318
|
this.handleDropEvent(event.nativeEvent, event.position);
|
|
3250
|
-
}));
|
|
3319
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
3251
3320
|
}
|
|
3252
3321
|
initialize() {
|
|
3253
3322
|
var _a, _b;
|
|
@@ -3681,8 +3750,7 @@
|
|
|
3681
3750
|
this.layout(0, 0, true); // set some elements height/widths
|
|
3682
3751
|
this.addDisposables(this.gridview.onDidChange(() => {
|
|
3683
3752
|
this._bufferOnDidLayoutChange.fire();
|
|
3684
|
-
}))
|
|
3685
|
-
this.addDisposables(exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3753
|
+
}), exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3686
3754
|
this._bufferOnDidLayoutChange.fire();
|
|
3687
3755
|
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
3688
3756
|
this._onDidLayoutChange.fire();
|
|
@@ -3785,7 +3853,6 @@
|
|
|
3785
3853
|
this.gridview.layout(width, height);
|
|
3786
3854
|
}
|
|
3787
3855
|
dispose() {
|
|
3788
|
-
super.dispose();
|
|
3789
3856
|
this._onDidActiveGroupChange.dispose();
|
|
3790
3857
|
this._onDidAddGroup.dispose();
|
|
3791
3858
|
this._onDidRemoveGroup.dispose();
|
|
@@ -3794,6 +3861,7 @@
|
|
|
3794
3861
|
group.dispose();
|
|
3795
3862
|
}
|
|
3796
3863
|
this.gridview.dispose();
|
|
3864
|
+
super.dispose();
|
|
3797
3865
|
}
|
|
3798
3866
|
}
|
|
3799
3867
|
|
|
@@ -3857,7 +3925,7 @@
|
|
|
3857
3925
|
//
|
|
3858
3926
|
this._onUpdateParameters = new Emitter();
|
|
3859
3927
|
this.onUpdateParameters = this._onUpdateParameters.event;
|
|
3860
|
-
this.addDisposables(this.
|
|
3928
|
+
this.addDisposables(this.onDidFocusChange((event) => {
|
|
3861
3929
|
this._isFocused = event.isFocused;
|
|
3862
3930
|
}), this.onDidActiveChange((event) => {
|
|
3863
3931
|
this._isActive = event.isActive;
|
|
@@ -3866,14 +3934,12 @@
|
|
|
3866
3934
|
}), this.onDidDimensionsChange((event) => {
|
|
3867
3935
|
this._width = event.width;
|
|
3868
3936
|
this._height = event.height;
|
|
3869
|
-
}));
|
|
3937
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onFocusEvent, this._onActiveChange, this._onVisibilityChange, this._onUpdateParameters);
|
|
3870
3938
|
}
|
|
3871
3939
|
initialize(panel) {
|
|
3872
3940
|
this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
|
|
3873
3941
|
panel.update({
|
|
3874
|
-
params:
|
|
3875
|
-
params: parameters,
|
|
3876
|
-
},
|
|
3942
|
+
params: parameters,
|
|
3877
3943
|
});
|
|
3878
3944
|
});
|
|
3879
3945
|
}
|
|
@@ -3968,12 +4034,12 @@
|
|
|
3968
4034
|
this._element.style.height = '100%';
|
|
3969
4035
|
this._element.style.width = '100%';
|
|
3970
4036
|
this._element.style.overflow = 'hidden';
|
|
3971
|
-
const
|
|
3972
|
-
this.addDisposables(this.api, onDidFocus(() => {
|
|
4037
|
+
const focusTracker = trackFocus(this._element);
|
|
4038
|
+
this.addDisposables(this.api, focusTracker.onDidFocus(() => {
|
|
3973
4039
|
this.api._onDidChangeFocus.fire({ isFocused: true });
|
|
3974
|
-
}), onDidBlur(() => {
|
|
4040
|
+
}), focusTracker.onDidBlur(() => {
|
|
3975
4041
|
this.api._onDidChangeFocus.fire({ isFocused: false });
|
|
3976
|
-
}));
|
|
4042
|
+
}), focusTracker);
|
|
3977
4043
|
}
|
|
3978
4044
|
focus() {
|
|
3979
4045
|
this.api._onFocusEvent.fire();
|
|
@@ -3994,7 +4060,18 @@
|
|
|
3994
4060
|
}
|
|
3995
4061
|
update(event) {
|
|
3996
4062
|
var _a, _b;
|
|
4063
|
+
// merge the new parameters with the existing parameters
|
|
3997
4064
|
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) });
|
|
4065
|
+
/**
|
|
4066
|
+
* delete new keys that have a value of undefined,
|
|
4067
|
+
* allow values of null
|
|
4068
|
+
*/
|
|
4069
|
+
for (const key of Object.keys(event.params)) {
|
|
4070
|
+
if (event.params[key] === undefined) {
|
|
4071
|
+
delete this._params.params[key];
|
|
4072
|
+
}
|
|
4073
|
+
}
|
|
4074
|
+
// update the view with the updated props
|
|
3998
4075
|
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
|
|
3999
4076
|
}
|
|
4000
4077
|
toJSON() {
|
|
@@ -4008,9 +4085,9 @@
|
|
|
4008
4085
|
}
|
|
4009
4086
|
dispose() {
|
|
4010
4087
|
var _a;
|
|
4011
|
-
super.dispose();
|
|
4012
4088
|
this.api.dispose();
|
|
4013
4089
|
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
4090
|
+
super.dispose();
|
|
4014
4091
|
}
|
|
4015
4092
|
}
|
|
4016
4093
|
|
|
@@ -4389,7 +4466,7 @@
|
|
|
4389
4466
|
this._maximumHeight = options.maximumHeight;
|
|
4390
4467
|
}
|
|
4391
4468
|
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
|
|
4392
|
-
this.addDisposables(this.
|
|
4469
|
+
this.addDisposables(this.api.onVisibilityChange((event) => {
|
|
4393
4470
|
const { isVisible } = event;
|
|
4394
4471
|
const { accessor } = this._params;
|
|
4395
4472
|
accessor.setVisible(this, isVisible);
|
|
@@ -4418,7 +4495,7 @@
|
|
|
4418
4495
|
height: event.height,
|
|
4419
4496
|
width: event.width,
|
|
4420
4497
|
});
|
|
4421
|
-
}));
|
|
4498
|
+
}), this._onDidChange);
|
|
4422
4499
|
}
|
|
4423
4500
|
setVisible(isVisible) {
|
|
4424
4501
|
this.api._onDidVisibilityChange.fire({ isVisible });
|
|
@@ -4575,7 +4652,7 @@
|
|
|
4575
4652
|
this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
|
|
4576
4653
|
}
|
|
4577
4654
|
setTitle(title) {
|
|
4578
|
-
this.panel.
|
|
4655
|
+
this.panel.setTitle(title);
|
|
4579
4656
|
}
|
|
4580
4657
|
close() {
|
|
4581
4658
|
this.group.model.closePanel(this.panel);
|
|
@@ -4640,12 +4717,18 @@
|
|
|
4640
4717
|
}
|
|
4641
4718
|
}
|
|
4642
4719
|
update(event) {
|
|
4643
|
-
|
|
4644
|
-
this._params = Object.assign(Object.assign({}, (this._params || {})), event.params
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4720
|
+
// merge the new parameters with the existing parameters
|
|
4721
|
+
this._params = Object.assign(Object.assign({}, (this._params || {})), event.params);
|
|
4722
|
+
/**
|
|
4723
|
+
* delete new keys that have a value of undefined,
|
|
4724
|
+
* allow values of null
|
|
4725
|
+
*/
|
|
4726
|
+
for (const key of Object.keys(event.params)) {
|
|
4727
|
+
if (event.params[key] === undefined) {
|
|
4728
|
+
delete this._params[key];
|
|
4729
|
+
}
|
|
4648
4730
|
}
|
|
4731
|
+
// update the view with the updated props
|
|
4649
4732
|
this.view.update({
|
|
4650
4733
|
params: {
|
|
4651
4734
|
params: this._params,
|
|
@@ -5021,7 +5104,7 @@
|
|
|
5021
5104
|
size: { type: 'pixels', value: 20 },
|
|
5022
5105
|
},
|
|
5023
5106
|
});
|
|
5024
|
-
this.addDisposables(dropTarget
|
|
5107
|
+
this.addDisposables(dropTarget.onDrop((event) => {
|
|
5025
5108
|
const data = getPanelData();
|
|
5026
5109
|
if (data) {
|
|
5027
5110
|
this.moveGroupOrPanel(this.orthogonalize(event.position), data.groupId, data.panelId || undefined, 'center');
|
|
@@ -5029,7 +5112,7 @@
|
|
|
5029
5112
|
else {
|
|
5030
5113
|
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: null, getData: getPanelData }));
|
|
5031
5114
|
}
|
|
5032
|
-
}));
|
|
5115
|
+
}), dropTarget);
|
|
5033
5116
|
this._api = new DockviewApi(this);
|
|
5034
5117
|
this.updateWatermark();
|
|
5035
5118
|
}
|
|
@@ -5353,31 +5436,33 @@
|
|
|
5353
5436
|
}
|
|
5354
5437
|
super.doRemoveGroup(group, { skipActive });
|
|
5355
5438
|
}
|
|
5356
|
-
moveGroupOrPanel(
|
|
5439
|
+
moveGroupOrPanel(destinationGroup, sourceGroupId, sourceItemId, destinationTarget, destinationIndex) {
|
|
5357
5440
|
var _a;
|
|
5358
|
-
const sourceGroup =
|
|
5359
|
-
? (_a = this._groups.get(
|
|
5441
|
+
const sourceGroup = sourceGroupId
|
|
5442
|
+
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
5360
5443
|
: undefined;
|
|
5361
|
-
if (
|
|
5444
|
+
if (sourceItemId === undefined) {
|
|
5362
5445
|
if (sourceGroup) {
|
|
5363
|
-
this.moveGroup(sourceGroup,
|
|
5446
|
+
this.moveGroup(sourceGroup, destinationGroup, destinationTarget);
|
|
5364
5447
|
}
|
|
5365
5448
|
return;
|
|
5366
5449
|
}
|
|
5367
|
-
if (!
|
|
5368
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(
|
|
5369
|
-
this.panels.find((panel) => panel.id ===
|
|
5450
|
+
if (!destinationTarget || destinationTarget === 'center') {
|
|
5451
|
+
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(sourceItemId)) ||
|
|
5452
|
+
this.panels.find((panel) => panel.id === sourceItemId);
|
|
5370
5453
|
if (!groupItem) {
|
|
5371
|
-
throw new Error(`No panel with id ${
|
|
5454
|
+
throw new Error(`No panel with id ${sourceItemId}`);
|
|
5372
5455
|
}
|
|
5373
5456
|
if ((sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.size) === 0) {
|
|
5374
5457
|
this.doRemoveGroup(sourceGroup);
|
|
5375
5458
|
}
|
|
5376
|
-
|
|
5459
|
+
destinationGroup.model.openPanel(groupItem, {
|
|
5460
|
+
index: destinationIndex,
|
|
5461
|
+
});
|
|
5377
5462
|
}
|
|
5378
5463
|
else {
|
|
5379
|
-
const referenceLocation = getGridLocation(
|
|
5380
|
-
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation,
|
|
5464
|
+
const referenceLocation = getGridLocation(destinationGroup.element);
|
|
5465
|
+
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5381
5466
|
if (sourceGroup && sourceGroup.size < 2) {
|
|
5382
5467
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
5383
5468
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
@@ -5395,18 +5480,18 @@
|
|
|
5395
5480
|
skipDispose: true,
|
|
5396
5481
|
});
|
|
5397
5482
|
// after deleting the group we need to re-evaulate the ref location
|
|
5398
|
-
const updatedReferenceLocation = getGridLocation(
|
|
5399
|
-
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation,
|
|
5483
|
+
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
5484
|
+
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
5400
5485
|
this.doAddGroup(targetGroup, location);
|
|
5401
5486
|
}
|
|
5402
5487
|
}
|
|
5403
5488
|
else {
|
|
5404
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(
|
|
5405
|
-
this.panels.find((panel) => panel.id ===
|
|
5489
|
+
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(sourceItemId)) ||
|
|
5490
|
+
this.panels.find((panel) => panel.id === sourceItemId);
|
|
5406
5491
|
if (!groupItem) {
|
|
5407
|
-
throw new Error(`No panel with id ${
|
|
5492
|
+
throw new Error(`No panel with id ${sourceItemId}`);
|
|
5408
5493
|
}
|
|
5409
|
-
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation,
|
|
5494
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5410
5495
|
const group = this.createGroupAtLocation(dropLocation);
|
|
5411
5496
|
group.model.openPanel(groupItem);
|
|
5412
5497
|
}
|
|
@@ -5500,11 +5585,11 @@
|
|
|
5500
5585
|
return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
|
|
5501
5586
|
}
|
|
5502
5587
|
dispose() {
|
|
5503
|
-
super.dispose();
|
|
5504
5588
|
this._onDidActivePanelChange.dispose();
|
|
5505
5589
|
this._onDidAddPanel.dispose();
|
|
5506
5590
|
this._onDidRemovePanel.dispose();
|
|
5507
5591
|
this._onDidLayoutFromJSON.dispose();
|
|
5592
|
+
super.dispose();
|
|
5508
5593
|
}
|
|
5509
5594
|
}
|
|
5510
5595
|
|
|
@@ -5762,7 +5847,7 @@
|
|
|
5762
5847
|
}
|
|
5763
5848
|
set splitview(value) {
|
|
5764
5849
|
this._splitview = value;
|
|
5765
|
-
this.
|
|
5850
|
+
this._splitviewChangeDisposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
|
|
5766
5851
|
this._onDidLayoutChange.fire(undefined);
|
|
5767
5852
|
}), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
|
|
5768
5853
|
}
|
|
@@ -5784,7 +5869,7 @@
|
|
|
5784
5869
|
}
|
|
5785
5870
|
constructor(options) {
|
|
5786
5871
|
super(options.parentElement);
|
|
5787
|
-
this.
|
|
5872
|
+
this._splitviewChangeDisposable = new MutableDisposable();
|
|
5788
5873
|
this._panels = new Map();
|
|
5789
5874
|
this._onDidLayoutfromJSON = new Emitter();
|
|
5790
5875
|
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
@@ -5802,7 +5887,7 @@
|
|
|
5802
5887
|
options.frameworkComponents = {};
|
|
5803
5888
|
}
|
|
5804
5889
|
this.splitview = new Splitview(this.element, options);
|
|
5805
|
-
this.addDisposables(this.
|
|
5890
|
+
this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
|
|
5806
5891
|
}
|
|
5807
5892
|
updateOptions(options) {
|
|
5808
5893
|
const hasOrientationChanged = typeof options.orientation === 'string' &&
|
|
@@ -5840,15 +5925,15 @@
|
|
|
5840
5925
|
}
|
|
5841
5926
|
}
|
|
5842
5927
|
removePanel(panel, sizing) {
|
|
5843
|
-
const
|
|
5844
|
-
if (!
|
|
5928
|
+
const item = this._panels.get(panel.id);
|
|
5929
|
+
if (!item) {
|
|
5845
5930
|
throw new Error(`unknown splitview panel ${panel.id}`);
|
|
5846
5931
|
}
|
|
5847
|
-
|
|
5848
|
-
disposable.value.dispose();
|
|
5932
|
+
item.dispose();
|
|
5849
5933
|
this._panels.delete(panel.id);
|
|
5850
5934
|
const index = this.panels.findIndex((_) => _ === panel);
|
|
5851
|
-
this.splitview.removeView(index, sizing);
|
|
5935
|
+
const removedView = this.splitview.removeView(index, sizing);
|
|
5936
|
+
removedView.dispose();
|
|
5852
5937
|
const panels = this.panels;
|
|
5853
5938
|
if (panels.length > 0) {
|
|
5854
5939
|
this.setActive(panels[panels.length - 1]);
|
|
@@ -5895,7 +5980,7 @@
|
|
|
5895
5980
|
}
|
|
5896
5981
|
this.setActive(view, true);
|
|
5897
5982
|
});
|
|
5898
|
-
this._panels.set(view.id,
|
|
5983
|
+
this._panels.set(view.id, disposable);
|
|
5899
5984
|
}
|
|
5900
5985
|
toJSON() {
|
|
5901
5986
|
var _a;
|
|
@@ -5968,20 +6053,26 @@
|
|
|
5968
6053
|
this._onDidLayoutfromJSON.fire();
|
|
5969
6054
|
}
|
|
5970
6055
|
clear() {
|
|
5971
|
-
for (const
|
|
5972
|
-
|
|
5973
|
-
value.value.dispose();
|
|
6056
|
+
for (const disposable of this._panels.values()) {
|
|
6057
|
+
disposable.dispose();
|
|
5974
6058
|
}
|
|
5975
6059
|
this._panels.clear();
|
|
5976
|
-
this.splitview.
|
|
6060
|
+
while (this.splitview.length > 0) {
|
|
6061
|
+
const view = this.splitview.removeView(0, exports.Sizing.Distribute, true);
|
|
6062
|
+
view.dispose();
|
|
6063
|
+
}
|
|
5977
6064
|
}
|
|
5978
6065
|
dispose() {
|
|
5979
|
-
for (const
|
|
5980
|
-
|
|
5981
|
-
value.value.dispose();
|
|
6066
|
+
for (const disposable of this._panels.values()) {
|
|
6067
|
+
disposable.dispose();
|
|
5982
6068
|
}
|
|
5983
6069
|
this._panels.clear();
|
|
6070
|
+
const views = this.splitview.getViews();
|
|
6071
|
+
this._splitviewChangeDisposable.dispose();
|
|
5984
6072
|
this.splitview.dispose();
|
|
6073
|
+
for (const view of views) {
|
|
6074
|
+
view.dispose();
|
|
6075
|
+
}
|
|
5985
6076
|
super.dispose();
|
|
5986
6077
|
}
|
|
5987
6078
|
}
|