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
|
@@ -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
|
*/
|
|
@@ -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,28 +158,50 @@
|
|
|
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 {
|
|
140
203
|
dispose: () => {
|
|
141
|
-
element.removeEventListener(type, listener);
|
|
204
|
+
element.removeEventListener(type, listener, options);
|
|
142
205
|
},
|
|
143
206
|
};
|
|
144
207
|
}
|
|
@@ -146,7 +209,7 @@
|
|
|
146
209
|
element.addEventListener(type, listener, options);
|
|
147
210
|
return {
|
|
148
211
|
dispose: () => {
|
|
149
|
-
element.removeEventListener(type, listener);
|
|
212
|
+
element.removeEventListener(type, listener, options);
|
|
150
213
|
},
|
|
151
214
|
};
|
|
152
215
|
}
|
|
@@ -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) {
|
|
@@ -911,12 +973,10 @@
|
|
|
911
973
|
this.saveProportions();
|
|
912
974
|
document.removeEventListener('mousemove', mousemove);
|
|
913
975
|
document.removeEventListener('mouseup', end);
|
|
914
|
-
document.removeEventListener('mouseend', end);
|
|
915
976
|
this._onDidSashEnd.fire(undefined);
|
|
916
977
|
};
|
|
917
978
|
document.addEventListener('mousemove', mousemove);
|
|
918
979
|
document.addEventListener('mouseup', end);
|
|
919
|
-
document.addEventListener('mouseend', end);
|
|
920
980
|
};
|
|
921
981
|
sash.addEventListener('mousedown', onStart);
|
|
922
982
|
const sashItem = {
|
|
@@ -942,7 +1002,7 @@
|
|
|
942
1002
|
distributeViewSizes() {
|
|
943
1003
|
const flexibleViewItems = [];
|
|
944
1004
|
let flexibleSize = 0;
|
|
945
|
-
for (const item of this.
|
|
1005
|
+
for (const item of this.viewItems) {
|
|
946
1006
|
if (item.maximumSize - item.minimumSize > 0) {
|
|
947
1007
|
flexibleViewItems.push(item);
|
|
948
1008
|
flexibleSize += item.size;
|
|
@@ -952,17 +1012,17 @@
|
|
|
952
1012
|
for (const item of flexibleViewItems) {
|
|
953
1013
|
item.size = clamp(size, item.minimumSize, item.maximumSize);
|
|
954
1014
|
}
|
|
955
|
-
const indexes = range(this.
|
|
956
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
957
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1015
|
+
const indexes = range(this.viewItems.length);
|
|
1016
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1017
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
958
1018
|
this.relayout(lowPriorityIndexes, highPriorityIndexes);
|
|
959
1019
|
}
|
|
960
1020
|
removeView(index, sizing, skipLayout = false) {
|
|
961
1021
|
// Remove view
|
|
962
|
-
const viewItem = this.
|
|
1022
|
+
const viewItem = this.viewItems.splice(index, 1)[0];
|
|
963
1023
|
viewItem.dispose();
|
|
964
1024
|
// Remove sash
|
|
965
|
-
if (this.
|
|
1025
|
+
if (this.viewItems.length >= 1) {
|
|
966
1026
|
const sashIndex = Math.max(index - 1, 0);
|
|
967
1027
|
const sashItem = this.sashes.splice(sashIndex, 1)[0];
|
|
968
1028
|
sashItem.disposable();
|
|
@@ -977,10 +1037,10 @@
|
|
|
977
1037
|
return viewItem.view;
|
|
978
1038
|
}
|
|
979
1039
|
getViewCachedVisibleSize(index) {
|
|
980
|
-
if (index < 0 || index >= this.
|
|
1040
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
981
1041
|
throw new Error('Index out of bounds');
|
|
982
1042
|
}
|
|
983
|
-
const viewItem = this.
|
|
1043
|
+
const viewItem = this.viewItems[index];
|
|
984
1044
|
return viewItem.cachedVisibleSize;
|
|
985
1045
|
}
|
|
986
1046
|
moveView(from, to) {
|
|
@@ -996,14 +1056,14 @@
|
|
|
996
1056
|
this.size = size;
|
|
997
1057
|
this.orthogonalSize = orthogonalSize;
|
|
998
1058
|
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.
|
|
1059
|
+
const indexes = range(this.viewItems.length);
|
|
1060
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1061
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1062
|
+
this.resize(this.viewItems.length - 1, size - previousSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
1003
1063
|
}
|
|
1004
1064
|
else {
|
|
1005
|
-
for (let i = 0; i < this.
|
|
1006
|
-
const item = this.
|
|
1065
|
+
for (let i = 0; i < this.viewItems.length; i++) {
|
|
1066
|
+
const item = this.viewItems[i];
|
|
1007
1067
|
item.size = clamp(Math.round(this.proportions[i] * size), item.minimumSize, item.maximumSize);
|
|
1008
1068
|
}
|
|
1009
1069
|
}
|
|
@@ -1011,18 +1071,18 @@
|
|
|
1011
1071
|
this.layoutViews();
|
|
1012
1072
|
}
|
|
1013
1073
|
relayout(lowPriorityIndexes, highPriorityIndexes) {
|
|
1014
|
-
const contentSize = this.
|
|
1015
|
-
this.resize(this.
|
|
1074
|
+
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1075
|
+
this.resize(this.viewItems.length - 1, this._size - contentSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
1016
1076
|
this.distributeEmptySpace();
|
|
1017
1077
|
this.layoutViews();
|
|
1018
1078
|
this.saveProportions();
|
|
1019
1079
|
}
|
|
1020
1080
|
distributeEmptySpace(lowPriorityIndex) {
|
|
1021
|
-
const contentSize = this.
|
|
1081
|
+
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1022
1082
|
let emptyDelta = this.size - contentSize;
|
|
1023
|
-
const indexes = range(this.
|
|
1024
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
1025
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1083
|
+
const indexes = range(this.viewItems.length - 1, -1);
|
|
1084
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1085
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1026
1086
|
for (const index of highPriorityIndexes) {
|
|
1027
1087
|
pushToStart(indexes, index);
|
|
1028
1088
|
}
|
|
@@ -1033,7 +1093,7 @@
|
|
|
1033
1093
|
pushToEnd(indexes, lowPriorityIndex);
|
|
1034
1094
|
}
|
|
1035
1095
|
for (let i = 0; emptyDelta !== 0 && i < indexes.length; i++) {
|
|
1036
|
-
const item = this.
|
|
1096
|
+
const item = this.viewItems[indexes[i]];
|
|
1037
1097
|
const size = clamp(item.size + emptyDelta, item.minimumSize, item.maximumSize);
|
|
1038
1098
|
const viewDelta = size - item.size;
|
|
1039
1099
|
emptyDelta -= viewDelta;
|
|
@@ -1042,16 +1102,16 @@
|
|
|
1042
1102
|
}
|
|
1043
1103
|
saveProportions() {
|
|
1044
1104
|
if (this.proportionalLayout && this.contentSize > 0) {
|
|
1045
|
-
this._proportions = this.
|
|
1105
|
+
this._proportions = this.viewItems.map((i) => i.size / this.contentSize);
|
|
1046
1106
|
}
|
|
1047
1107
|
}
|
|
1048
1108
|
layoutViews() {
|
|
1049
|
-
this.contentSize = this.
|
|
1109
|
+
this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1050
1110
|
let sum = 0;
|
|
1051
1111
|
const x = [];
|
|
1052
1112
|
this.updateSashEnablement();
|
|
1053
|
-
for (let i = 0; i < this.
|
|
1054
|
-
sum += this.
|
|
1113
|
+
for (let i = 0; i < this.viewItems.length - 1; i++) {
|
|
1114
|
+
sum += this.viewItems[i].size;
|
|
1055
1115
|
x.push(sum);
|
|
1056
1116
|
const offset = Math.min(Math.max(0, sum - 2), this.size - 4);
|
|
1057
1117
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
@@ -1063,7 +1123,7 @@
|
|
|
1063
1123
|
this.sashes[i].container.style.top = `${offset}px`;
|
|
1064
1124
|
}
|
|
1065
1125
|
}
|
|
1066
|
-
this.
|
|
1126
|
+
this.viewItems.forEach((view, i) => {
|
|
1067
1127
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
1068
1128
|
view.container.style.width = `${view.size}px`;
|
|
1069
1129
|
view.container.style.left = i == 0 ? '0px' : `${x[i - 1]}px`;
|
|
@@ -1082,7 +1142,7 @@
|
|
|
1082
1142
|
findFirstSnapIndex(indexes) {
|
|
1083
1143
|
// visible views first
|
|
1084
1144
|
for (const index of indexes) {
|
|
1085
|
-
const viewItem = this.
|
|
1145
|
+
const viewItem = this.viewItems[index];
|
|
1086
1146
|
if (!viewItem.visible) {
|
|
1087
1147
|
continue;
|
|
1088
1148
|
}
|
|
@@ -1092,7 +1152,7 @@
|
|
|
1092
1152
|
}
|
|
1093
1153
|
// then, hidden views
|
|
1094
1154
|
for (const index of indexes) {
|
|
1095
|
-
const viewItem = this.
|
|
1155
|
+
const viewItem = this.viewItems[index];
|
|
1096
1156
|
if (viewItem.visible &&
|
|
1097
1157
|
viewItem.maximumSize - viewItem.minimumSize > 0) {
|
|
1098
1158
|
return undefined;
|
|
@@ -1105,10 +1165,10 @@
|
|
|
1105
1165
|
}
|
|
1106
1166
|
updateSashEnablement() {
|
|
1107
1167
|
let previous = false;
|
|
1108
|
-
const collapsesDown = this.
|
|
1168
|
+
const collapsesDown = this.viewItems.map((i) => (previous = i.size - i.minimumSize > 0 || previous));
|
|
1109
1169
|
previous = false;
|
|
1110
|
-
const expandsDown = this.
|
|
1111
|
-
const reverseViews = [...this.
|
|
1170
|
+
const expandsDown = this.viewItems.map((i) => (previous = i.maximumSize - i.size > 0 || previous));
|
|
1171
|
+
const reverseViews = [...this.viewItems].reverse();
|
|
1112
1172
|
previous = false;
|
|
1113
1173
|
const collapsesUp = reverseViews
|
|
1114
1174
|
.map((i) => (previous = i.size - i.minimumSize > 0 || previous))
|
|
@@ -1120,19 +1180,19 @@
|
|
|
1120
1180
|
let position = 0;
|
|
1121
1181
|
for (let index = 0; index < this.sashes.length; index++) {
|
|
1122
1182
|
const sash = this.sashes[index];
|
|
1123
|
-
const viewItem = this.
|
|
1183
|
+
const viewItem = this.viewItems[index];
|
|
1124
1184
|
position += viewItem.size;
|
|
1125
1185
|
const min = !(collapsesDown[index] && expandsUp[index + 1]);
|
|
1126
1186
|
const max = !(expandsDown[index] && collapsesUp[index + 1]);
|
|
1127
1187
|
if (min && max) {
|
|
1128
1188
|
const upIndexes = range(index, -1);
|
|
1129
|
-
const downIndexes = range(index + 1, this.
|
|
1189
|
+
const downIndexes = range(index + 1, this.viewItems.length);
|
|
1130
1190
|
const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);
|
|
1131
1191
|
const snapAfterIndex = this.findFirstSnapIndex(downIndexes);
|
|
1132
1192
|
const snappedBefore = typeof snapBeforeIndex === 'number' &&
|
|
1133
|
-
!this.
|
|
1193
|
+
!this.viewItems[snapBeforeIndex].visible;
|
|
1134
1194
|
const snappedAfter = typeof snapAfterIndex === 'number' &&
|
|
1135
|
-
!this.
|
|
1195
|
+
!this.viewItems[snapAfterIndex].visible;
|
|
1136
1196
|
if (snappedBefore &&
|
|
1137
1197
|
collapsesUp[index] &&
|
|
1138
1198
|
(position > 0 || this.startSnappingEnabled)) {
|
|
@@ -1192,6 +1252,9 @@
|
|
|
1192
1252
|
break;
|
|
1193
1253
|
}
|
|
1194
1254
|
}
|
|
1255
|
+
for (const viewItem of this.viewItems) {
|
|
1256
|
+
viewItem.dispose();
|
|
1257
|
+
}
|
|
1195
1258
|
this.element.remove();
|
|
1196
1259
|
}
|
|
1197
1260
|
}
|
|
@@ -1626,7 +1689,7 @@
|
|
|
1626
1689
|
throw new Error('Invalid index');
|
|
1627
1690
|
}
|
|
1628
1691
|
this.splitview.removeView(index, sizing);
|
|
1629
|
-
this._removeChild(index);
|
|
1692
|
+
return this._removeChild(index);
|
|
1630
1693
|
}
|
|
1631
1694
|
_addChild(node, index) {
|
|
1632
1695
|
this.children.splice(index, 0, node);
|
|
@@ -1648,10 +1711,10 @@
|
|
|
1648
1711
|
});
|
|
1649
1712
|
}
|
|
1650
1713
|
dispose() {
|
|
1651
|
-
super.dispose();
|
|
1652
1714
|
this._childrenDisposable.dispose();
|
|
1653
|
-
this.children.forEach((child) => child.dispose());
|
|
1654
1715
|
this.splitview.dispose();
|
|
1716
|
+
this.children.forEach((child) => child.dispose());
|
|
1717
|
+
super.dispose();
|
|
1655
1718
|
}
|
|
1656
1719
|
}
|
|
1657
1720
|
|
|
@@ -1881,7 +1944,8 @@
|
|
|
1881
1944
|
if (oldRoot.children.length === 1) {
|
|
1882
1945
|
// can remove one level of redundant branching if there is only a single child
|
|
1883
1946
|
const childReference = oldRoot.children[0];
|
|
1884
|
-
oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
1947
|
+
const child = oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
1948
|
+
child.dispose();
|
|
1885
1949
|
oldRoot.dispose();
|
|
1886
1950
|
this._root.addChild(
|
|
1887
1951
|
/**
|
|
@@ -1988,7 +2052,8 @@
|
|
|
1988
2052
|
if (typeof newSiblingCachedVisibleSize === 'number') {
|
|
1989
2053
|
newSiblingSize = exports.Sizing.Invisible(newSiblingCachedVisibleSize);
|
|
1990
2054
|
}
|
|
1991
|
-
grandParent.removeChild(parentIndex);
|
|
2055
|
+
const child = grandParent.removeChild(parentIndex);
|
|
2056
|
+
child.dispose();
|
|
1992
2057
|
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize);
|
|
1993
2058
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
1994
2059
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
@@ -2550,6 +2615,7 @@
|
|
|
2550
2615
|
}
|
|
2551
2616
|
dispose() {
|
|
2552
2617
|
this.removeDropTarget();
|
|
2618
|
+
super.dispose();
|
|
2553
2619
|
}
|
|
2554
2620
|
toggleClasses(quadrant, width, height) {
|
|
2555
2621
|
var _a, _b, _c, _d;
|
|
@@ -2727,8 +2793,8 @@
|
|
|
2727
2793
|
if (this.panel.view) {
|
|
2728
2794
|
const _onDidFocus = this.panel.view.content.onDidFocus;
|
|
2729
2795
|
const _onDidBlur = this.panel.view.content.onDidBlur;
|
|
2730
|
-
const
|
|
2731
|
-
disposable.addDisposables(onDidFocus(() => this._onDidFocus.fire()), onDidBlur(() => this._onDidBlur.fire()));
|
|
2796
|
+
const focusTracker = trackFocus(this._element);
|
|
2797
|
+
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
|
|
2732
2798
|
if (_onDidFocus) {
|
|
2733
2799
|
disposable.addDisposables(_onDidFocus(() => this._onDidFocus.fire()));
|
|
2734
2800
|
}
|
|
@@ -2767,24 +2833,32 @@
|
|
|
2767
2833
|
constructor(el) {
|
|
2768
2834
|
super();
|
|
2769
2835
|
this.el = el;
|
|
2770
|
-
this.
|
|
2836
|
+
this.dataDisposable = new MutableDisposable();
|
|
2837
|
+
this.pointerEventsDisposable = new MutableDisposable();
|
|
2771
2838
|
this._onDragStart = new Emitter();
|
|
2772
2839
|
this.onDragStart = this._onDragStart.event;
|
|
2773
|
-
this.
|
|
2840
|
+
this.addDisposables(this._onDragStart, this.dataDisposable, this.pointerEventsDisposable);
|
|
2774
2841
|
this.configure();
|
|
2775
2842
|
}
|
|
2776
2843
|
configure() {
|
|
2777
2844
|
this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
|
|
2778
|
-
|
|
2845
|
+
const iframes = [
|
|
2779
2846
|
...getElementsByTagName('iframe'),
|
|
2780
2847
|
...getElementsByTagName('webview'),
|
|
2781
2848
|
];
|
|
2782
|
-
|
|
2849
|
+
this.pointerEventsDisposable.value = {
|
|
2850
|
+
dispose: () => {
|
|
2851
|
+
for (const iframe of iframes) {
|
|
2852
|
+
iframe.style.pointerEvents = 'auto';
|
|
2853
|
+
}
|
|
2854
|
+
},
|
|
2855
|
+
};
|
|
2856
|
+
for (const iframe of iframes) {
|
|
2783
2857
|
iframe.style.pointerEvents = 'none';
|
|
2784
2858
|
}
|
|
2785
2859
|
this.el.classList.add('dv-dragged');
|
|
2786
2860
|
setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
|
|
2787
|
-
this.
|
|
2861
|
+
this.dataDisposable.value = this.getData(event.dataTransfer);
|
|
2788
2862
|
if (event.dataTransfer) {
|
|
2789
2863
|
event.dataTransfer.effectAllowed = 'move';
|
|
2790
2864
|
/**
|
|
@@ -2799,11 +2873,8 @@
|
|
|
2799
2873
|
event.dataTransfer.setData('text/plain', '__dockview_internal_drag_event__');
|
|
2800
2874
|
}
|
|
2801
2875
|
}), addDisposableListener(this.el, 'dragend', () => {
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
}
|
|
2805
|
-
this.iframes = [];
|
|
2806
|
-
this.disposable.dispose();
|
|
2876
|
+
this.pointerEventsDisposable.dispose();
|
|
2877
|
+
this.dataDisposable.dispose();
|
|
2807
2878
|
}));
|
|
2808
2879
|
}
|
|
2809
2880
|
}
|
|
@@ -2821,13 +2892,12 @@
|
|
|
2821
2892
|
this.onChanged = this._onChanged.event;
|
|
2822
2893
|
this._onDropped = new Emitter();
|
|
2823
2894
|
this.onDrop = this._onDropped.event;
|
|
2824
|
-
this.addDisposables(this._onChanged, this._onDropped);
|
|
2825
2895
|
this._element = document.createElement('div');
|
|
2826
2896
|
this._element.className = 'tab';
|
|
2827
2897
|
this._element.tabIndex = 0;
|
|
2828
2898
|
this._element.draggable = true;
|
|
2829
2899
|
toggleClass(this.element, 'inactive-tab', true);
|
|
2830
|
-
this.addDisposables(new (class Handler extends DragHandler {
|
|
2900
|
+
this.addDisposables(this._onChanged, this._onDropped, new (class Handler extends DragHandler {
|
|
2831
2901
|
constructor() {
|
|
2832
2902
|
super(...arguments);
|
|
2833
2903
|
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
@@ -2840,9 +2910,6 @@
|
|
|
2840
2910
|
},
|
|
2841
2911
|
};
|
|
2842
2912
|
}
|
|
2843
|
-
dispose() {
|
|
2844
|
-
//
|
|
2845
|
-
}
|
|
2846
2913
|
})(this._element));
|
|
2847
2914
|
this.addDisposables(addDisposableListener(this._element, 'mousedown', (event) => {
|
|
2848
2915
|
if (event.defaultPrevented) {
|
|
@@ -2877,7 +2944,7 @@
|
|
|
2877
2944
|
});
|
|
2878
2945
|
this.addDisposables(this.droptarget.onDrop((event) => {
|
|
2879
2946
|
this._onDropped.fire(event);
|
|
2880
|
-
}));
|
|
2947
|
+
}), this.droptarget);
|
|
2881
2948
|
}
|
|
2882
2949
|
setActive(isActive) {
|
|
2883
2950
|
toggleClass(this.element, 'active-tab', isActive);
|
|
@@ -2892,7 +2959,6 @@
|
|
|
2892
2959
|
}
|
|
2893
2960
|
dispose() {
|
|
2894
2961
|
super.dispose();
|
|
2895
|
-
this.droptarget.dispose();
|
|
2896
2962
|
}
|
|
2897
2963
|
}
|
|
2898
2964
|
|
|
@@ -2938,9 +3004,6 @@
|
|
|
2938
3004
|
},
|
|
2939
3005
|
};
|
|
2940
3006
|
}
|
|
2941
|
-
dispose() {
|
|
2942
|
-
//
|
|
2943
|
-
}
|
|
2944
3007
|
}
|
|
2945
3008
|
|
|
2946
3009
|
class VoidContainer extends CompositeDisposable {
|
|
@@ -3096,6 +3159,7 @@
|
|
|
3096
3159
|
const tabToRemove = this.tabs.splice(index, 1)[0];
|
|
3097
3160
|
const { value, disposable } = tabToRemove;
|
|
3098
3161
|
disposable.dispose();
|
|
3162
|
+
value.dispose();
|
|
3099
3163
|
value.element.remove();
|
|
3100
3164
|
}
|
|
3101
3165
|
setActivePanel(panel) {
|
|
@@ -3139,9 +3203,10 @@
|
|
|
3139
3203
|
}
|
|
3140
3204
|
dispose() {
|
|
3141
3205
|
super.dispose();
|
|
3142
|
-
this.tabs
|
|
3143
|
-
|
|
3144
|
-
|
|
3206
|
+
for (const { value, disposable } of this.tabs) {
|
|
3207
|
+
disposable.dispose();
|
|
3208
|
+
value.dispose();
|
|
3209
|
+
}
|
|
3145
3210
|
this.tabs = [];
|
|
3146
3211
|
}
|
|
3147
3212
|
}
|
|
@@ -3239,7 +3304,7 @@
|
|
|
3239
3304
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
3240
3305
|
this.header.hidden = !!options.hideHeader;
|
|
3241
3306
|
this.locked = !!options.locked;
|
|
3242
|
-
this.addDisposables(this.
|
|
3307
|
+
this.addDisposables(this.tabsContainer.onDrop((event) => {
|
|
3243
3308
|
this.handleDropEvent(event.event, 'center', event.index);
|
|
3244
3309
|
}), this.contentContainer.onDidFocus(() => {
|
|
3245
3310
|
this.accessor.doSetGroupActive(this.groupPanel, true);
|
|
@@ -3247,7 +3312,7 @@
|
|
|
3247
3312
|
// noop
|
|
3248
3313
|
}), this.dropTarget.onDrop((event) => {
|
|
3249
3314
|
this.handleDropEvent(event.nativeEvent, event.position);
|
|
3250
|
-
}));
|
|
3315
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
3251
3316
|
}
|
|
3252
3317
|
initialize() {
|
|
3253
3318
|
var _a, _b;
|
|
@@ -3681,8 +3746,7 @@
|
|
|
3681
3746
|
this.layout(0, 0, true); // set some elements height/widths
|
|
3682
3747
|
this.addDisposables(this.gridview.onDidChange(() => {
|
|
3683
3748
|
this._bufferOnDidLayoutChange.fire();
|
|
3684
|
-
}))
|
|
3685
|
-
this.addDisposables(exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3749
|
+
}), exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3686
3750
|
this._bufferOnDidLayoutChange.fire();
|
|
3687
3751
|
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
3688
3752
|
this._onDidLayoutChange.fire();
|
|
@@ -3785,7 +3849,6 @@
|
|
|
3785
3849
|
this.gridview.layout(width, height);
|
|
3786
3850
|
}
|
|
3787
3851
|
dispose() {
|
|
3788
|
-
super.dispose();
|
|
3789
3852
|
this._onDidActiveGroupChange.dispose();
|
|
3790
3853
|
this._onDidAddGroup.dispose();
|
|
3791
3854
|
this._onDidRemoveGroup.dispose();
|
|
@@ -3794,6 +3857,7 @@
|
|
|
3794
3857
|
group.dispose();
|
|
3795
3858
|
}
|
|
3796
3859
|
this.gridview.dispose();
|
|
3860
|
+
super.dispose();
|
|
3797
3861
|
}
|
|
3798
3862
|
}
|
|
3799
3863
|
|
|
@@ -3857,7 +3921,7 @@
|
|
|
3857
3921
|
//
|
|
3858
3922
|
this._onUpdateParameters = new Emitter();
|
|
3859
3923
|
this.onUpdateParameters = this._onUpdateParameters.event;
|
|
3860
|
-
this.addDisposables(this.
|
|
3924
|
+
this.addDisposables(this.onDidFocusChange((event) => {
|
|
3861
3925
|
this._isFocused = event.isFocused;
|
|
3862
3926
|
}), this.onDidActiveChange((event) => {
|
|
3863
3927
|
this._isActive = event.isActive;
|
|
@@ -3866,14 +3930,12 @@
|
|
|
3866
3930
|
}), this.onDidDimensionsChange((event) => {
|
|
3867
3931
|
this._width = event.width;
|
|
3868
3932
|
this._height = event.height;
|
|
3869
|
-
}));
|
|
3933
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onFocusEvent, this._onActiveChange, this._onVisibilityChange, this._onUpdateParameters);
|
|
3870
3934
|
}
|
|
3871
3935
|
initialize(panel) {
|
|
3872
3936
|
this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
|
|
3873
3937
|
panel.update({
|
|
3874
|
-
params:
|
|
3875
|
-
params: parameters,
|
|
3876
|
-
},
|
|
3938
|
+
params: parameters,
|
|
3877
3939
|
});
|
|
3878
3940
|
});
|
|
3879
3941
|
}
|
|
@@ -3968,12 +4030,12 @@
|
|
|
3968
4030
|
this._element.style.height = '100%';
|
|
3969
4031
|
this._element.style.width = '100%';
|
|
3970
4032
|
this._element.style.overflow = 'hidden';
|
|
3971
|
-
const
|
|
3972
|
-
this.addDisposables(this.api, onDidFocus(() => {
|
|
4033
|
+
const focusTracker = trackFocus(this._element);
|
|
4034
|
+
this.addDisposables(this.api, focusTracker.onDidFocus(() => {
|
|
3973
4035
|
this.api._onDidChangeFocus.fire({ isFocused: true });
|
|
3974
|
-
}), onDidBlur(() => {
|
|
4036
|
+
}), focusTracker.onDidBlur(() => {
|
|
3975
4037
|
this.api._onDidChangeFocus.fire({ isFocused: false });
|
|
3976
|
-
}));
|
|
4038
|
+
}), focusTracker);
|
|
3977
4039
|
}
|
|
3978
4040
|
focus() {
|
|
3979
4041
|
this.api._onFocusEvent.fire();
|
|
@@ -3994,7 +4056,18 @@
|
|
|
3994
4056
|
}
|
|
3995
4057
|
update(event) {
|
|
3996
4058
|
var _a, _b;
|
|
4059
|
+
// merge the new parameters with the existing parameters
|
|
3997
4060
|
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) });
|
|
4061
|
+
/**
|
|
4062
|
+
* delete new keys that have a value of undefined,
|
|
4063
|
+
* allow values of null
|
|
4064
|
+
*/
|
|
4065
|
+
for (const key of Object.keys(event.params)) {
|
|
4066
|
+
if (event.params[key] === undefined) {
|
|
4067
|
+
delete this._params.params[key];
|
|
4068
|
+
}
|
|
4069
|
+
}
|
|
4070
|
+
// update the view with the updated props
|
|
3998
4071
|
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
|
|
3999
4072
|
}
|
|
4000
4073
|
toJSON() {
|
|
@@ -4008,9 +4081,9 @@
|
|
|
4008
4081
|
}
|
|
4009
4082
|
dispose() {
|
|
4010
4083
|
var _a;
|
|
4011
|
-
super.dispose();
|
|
4012
4084
|
this.api.dispose();
|
|
4013
4085
|
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
4086
|
+
super.dispose();
|
|
4014
4087
|
}
|
|
4015
4088
|
}
|
|
4016
4089
|
|
|
@@ -4389,7 +4462,7 @@
|
|
|
4389
4462
|
this._maximumHeight = options.maximumHeight;
|
|
4390
4463
|
}
|
|
4391
4464
|
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
|
|
4392
|
-
this.addDisposables(this.
|
|
4465
|
+
this.addDisposables(this.api.onVisibilityChange((event) => {
|
|
4393
4466
|
const { isVisible } = event;
|
|
4394
4467
|
const { accessor } = this._params;
|
|
4395
4468
|
accessor.setVisible(this, isVisible);
|
|
@@ -4418,7 +4491,7 @@
|
|
|
4418
4491
|
height: event.height,
|
|
4419
4492
|
width: event.width,
|
|
4420
4493
|
});
|
|
4421
|
-
}));
|
|
4494
|
+
}), this._onDidChange);
|
|
4422
4495
|
}
|
|
4423
4496
|
setVisible(isVisible) {
|
|
4424
4497
|
this.api._onDidVisibilityChange.fire({ isVisible });
|
|
@@ -4575,7 +4648,7 @@
|
|
|
4575
4648
|
this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
|
|
4576
4649
|
}
|
|
4577
4650
|
setTitle(title) {
|
|
4578
|
-
this.panel.
|
|
4651
|
+
this.panel.setTitle(title);
|
|
4579
4652
|
}
|
|
4580
4653
|
close() {
|
|
4581
4654
|
this.group.model.closePanel(this.panel);
|
|
@@ -4640,12 +4713,18 @@
|
|
|
4640
4713
|
}
|
|
4641
4714
|
}
|
|
4642
4715
|
update(event) {
|
|
4643
|
-
|
|
4644
|
-
this._params = Object.assign(Object.assign({}, (this._params || {})), event.params
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4716
|
+
// merge the new parameters with the existing parameters
|
|
4717
|
+
this._params = Object.assign(Object.assign({}, (this._params || {})), event.params);
|
|
4718
|
+
/**
|
|
4719
|
+
* delete new keys that have a value of undefined,
|
|
4720
|
+
* allow values of null
|
|
4721
|
+
*/
|
|
4722
|
+
for (const key of Object.keys(event.params)) {
|
|
4723
|
+
if (event.params[key] === undefined) {
|
|
4724
|
+
delete this._params[key];
|
|
4725
|
+
}
|
|
4648
4726
|
}
|
|
4727
|
+
// update the view with the updated props
|
|
4649
4728
|
this.view.update({
|
|
4650
4729
|
params: {
|
|
4651
4730
|
params: this._params,
|
|
@@ -5021,7 +5100,7 @@
|
|
|
5021
5100
|
size: { type: 'pixels', value: 20 },
|
|
5022
5101
|
},
|
|
5023
5102
|
});
|
|
5024
|
-
this.addDisposables(dropTarget
|
|
5103
|
+
this.addDisposables(dropTarget.onDrop((event) => {
|
|
5025
5104
|
const data = getPanelData();
|
|
5026
5105
|
if (data) {
|
|
5027
5106
|
this.moveGroupOrPanel(this.orthogonalize(event.position), data.groupId, data.panelId || undefined, 'center');
|
|
@@ -5029,7 +5108,7 @@
|
|
|
5029
5108
|
else {
|
|
5030
5109
|
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: null, getData: getPanelData }));
|
|
5031
5110
|
}
|
|
5032
|
-
}));
|
|
5111
|
+
}), dropTarget);
|
|
5033
5112
|
this._api = new DockviewApi(this);
|
|
5034
5113
|
this.updateWatermark();
|
|
5035
5114
|
}
|
|
@@ -5353,31 +5432,33 @@
|
|
|
5353
5432
|
}
|
|
5354
5433
|
super.doRemoveGroup(group, { skipActive });
|
|
5355
5434
|
}
|
|
5356
|
-
moveGroupOrPanel(
|
|
5435
|
+
moveGroupOrPanel(destinationGroup, sourceGroupId, sourceItemId, destinationTarget, destinationIndex) {
|
|
5357
5436
|
var _a;
|
|
5358
|
-
const sourceGroup =
|
|
5359
|
-
? (_a = this._groups.get(
|
|
5437
|
+
const sourceGroup = sourceGroupId
|
|
5438
|
+
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
5360
5439
|
: undefined;
|
|
5361
|
-
if (
|
|
5440
|
+
if (sourceItemId === undefined) {
|
|
5362
5441
|
if (sourceGroup) {
|
|
5363
|
-
this.moveGroup(sourceGroup,
|
|
5442
|
+
this.moveGroup(sourceGroup, destinationGroup, destinationTarget);
|
|
5364
5443
|
}
|
|
5365
5444
|
return;
|
|
5366
5445
|
}
|
|
5367
|
-
if (!
|
|
5368
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(
|
|
5369
|
-
this.panels.find((panel) => panel.id ===
|
|
5446
|
+
if (!destinationTarget || destinationTarget === 'center') {
|
|
5447
|
+
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(sourceItemId)) ||
|
|
5448
|
+
this.panels.find((panel) => panel.id === sourceItemId);
|
|
5370
5449
|
if (!groupItem) {
|
|
5371
|
-
throw new Error(`No panel with id ${
|
|
5450
|
+
throw new Error(`No panel with id ${sourceItemId}`);
|
|
5372
5451
|
}
|
|
5373
5452
|
if ((sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.size) === 0) {
|
|
5374
5453
|
this.doRemoveGroup(sourceGroup);
|
|
5375
5454
|
}
|
|
5376
|
-
|
|
5455
|
+
destinationGroup.model.openPanel(groupItem, {
|
|
5456
|
+
index: destinationIndex,
|
|
5457
|
+
});
|
|
5377
5458
|
}
|
|
5378
5459
|
else {
|
|
5379
|
-
const referenceLocation = getGridLocation(
|
|
5380
|
-
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation,
|
|
5460
|
+
const referenceLocation = getGridLocation(destinationGroup.element);
|
|
5461
|
+
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5381
5462
|
if (sourceGroup && sourceGroup.size < 2) {
|
|
5382
5463
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
5383
5464
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
@@ -5395,18 +5476,18 @@
|
|
|
5395
5476
|
skipDispose: true,
|
|
5396
5477
|
});
|
|
5397
5478
|
// after deleting the group we need to re-evaulate the ref location
|
|
5398
|
-
const updatedReferenceLocation = getGridLocation(
|
|
5399
|
-
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation,
|
|
5479
|
+
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
5480
|
+
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
5400
5481
|
this.doAddGroup(targetGroup, location);
|
|
5401
5482
|
}
|
|
5402
5483
|
}
|
|
5403
5484
|
else {
|
|
5404
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(
|
|
5405
|
-
this.panels.find((panel) => panel.id ===
|
|
5485
|
+
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(sourceItemId)) ||
|
|
5486
|
+
this.panels.find((panel) => panel.id === sourceItemId);
|
|
5406
5487
|
if (!groupItem) {
|
|
5407
|
-
throw new Error(`No panel with id ${
|
|
5488
|
+
throw new Error(`No panel with id ${sourceItemId}`);
|
|
5408
5489
|
}
|
|
5409
|
-
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation,
|
|
5490
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5410
5491
|
const group = this.createGroupAtLocation(dropLocation);
|
|
5411
5492
|
group.model.openPanel(groupItem);
|
|
5412
5493
|
}
|
|
@@ -5500,11 +5581,11 @@
|
|
|
5500
5581
|
return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
|
|
5501
5582
|
}
|
|
5502
5583
|
dispose() {
|
|
5503
|
-
super.dispose();
|
|
5504
5584
|
this._onDidActivePanelChange.dispose();
|
|
5505
5585
|
this._onDidAddPanel.dispose();
|
|
5506
5586
|
this._onDidRemovePanel.dispose();
|
|
5507
5587
|
this._onDidLayoutFromJSON.dispose();
|
|
5588
|
+
super.dispose();
|
|
5508
5589
|
}
|
|
5509
5590
|
}
|
|
5510
5591
|
|
|
@@ -5762,7 +5843,7 @@
|
|
|
5762
5843
|
}
|
|
5763
5844
|
set splitview(value) {
|
|
5764
5845
|
this._splitview = value;
|
|
5765
|
-
this.
|
|
5846
|
+
this._splitviewChangeDisposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
|
|
5766
5847
|
this._onDidLayoutChange.fire(undefined);
|
|
5767
5848
|
}), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
|
|
5768
5849
|
}
|
|
@@ -5784,7 +5865,7 @@
|
|
|
5784
5865
|
}
|
|
5785
5866
|
constructor(options) {
|
|
5786
5867
|
super(options.parentElement);
|
|
5787
|
-
this.
|
|
5868
|
+
this._splitviewChangeDisposable = new MutableDisposable();
|
|
5788
5869
|
this._panels = new Map();
|
|
5789
5870
|
this._onDidLayoutfromJSON = new Emitter();
|
|
5790
5871
|
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
@@ -5802,7 +5883,7 @@
|
|
|
5802
5883
|
options.frameworkComponents = {};
|
|
5803
5884
|
}
|
|
5804
5885
|
this.splitview = new Splitview(this.element, options);
|
|
5805
|
-
this.addDisposables(this.
|
|
5886
|
+
this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
|
|
5806
5887
|
}
|
|
5807
5888
|
updateOptions(options) {
|
|
5808
5889
|
const hasOrientationChanged = typeof options.orientation === 'string' &&
|
|
@@ -5840,15 +5921,15 @@
|
|
|
5840
5921
|
}
|
|
5841
5922
|
}
|
|
5842
5923
|
removePanel(panel, sizing) {
|
|
5843
|
-
const
|
|
5844
|
-
if (!
|
|
5924
|
+
const item = this._panels.get(panel.id);
|
|
5925
|
+
if (!item) {
|
|
5845
5926
|
throw new Error(`unknown splitview panel ${panel.id}`);
|
|
5846
5927
|
}
|
|
5847
|
-
|
|
5848
|
-
disposable.value.dispose();
|
|
5928
|
+
item.dispose();
|
|
5849
5929
|
this._panels.delete(panel.id);
|
|
5850
5930
|
const index = this.panels.findIndex((_) => _ === panel);
|
|
5851
|
-
this.splitview.removeView(index, sizing);
|
|
5931
|
+
const removedView = this.splitview.removeView(index, sizing);
|
|
5932
|
+
removedView.dispose();
|
|
5852
5933
|
const panels = this.panels;
|
|
5853
5934
|
if (panels.length > 0) {
|
|
5854
5935
|
this.setActive(panels[panels.length - 1]);
|
|
@@ -5895,7 +5976,7 @@
|
|
|
5895
5976
|
}
|
|
5896
5977
|
this.setActive(view, true);
|
|
5897
5978
|
});
|
|
5898
|
-
this._panels.set(view.id,
|
|
5979
|
+
this._panels.set(view.id, disposable);
|
|
5899
5980
|
}
|
|
5900
5981
|
toJSON() {
|
|
5901
5982
|
var _a;
|
|
@@ -5968,20 +6049,26 @@
|
|
|
5968
6049
|
this._onDidLayoutfromJSON.fire();
|
|
5969
6050
|
}
|
|
5970
6051
|
clear() {
|
|
5971
|
-
for (const
|
|
5972
|
-
|
|
5973
|
-
value.value.dispose();
|
|
6052
|
+
for (const disposable of this._panels.values()) {
|
|
6053
|
+
disposable.dispose();
|
|
5974
6054
|
}
|
|
5975
6055
|
this._panels.clear();
|
|
5976
|
-
this.splitview.
|
|
6056
|
+
while (this.splitview.length > 0) {
|
|
6057
|
+
const view = this.splitview.removeView(0, exports.Sizing.Distribute, true);
|
|
6058
|
+
view.dispose();
|
|
6059
|
+
}
|
|
5977
6060
|
}
|
|
5978
6061
|
dispose() {
|
|
5979
|
-
for (const
|
|
5980
|
-
|
|
5981
|
-
value.value.dispose();
|
|
6062
|
+
for (const disposable of this._panels.values()) {
|
|
6063
|
+
disposable.dispose();
|
|
5982
6064
|
}
|
|
5983
6065
|
this._panels.clear();
|
|
6066
|
+
const views = this.splitview.getViews();
|
|
6067
|
+
this._splitviewChangeDisposable.dispose();
|
|
5984
6068
|
this.splitview.dispose();
|
|
6069
|
+
for (const view of views) {
|
|
6070
|
+
view.dispose();
|
|
6071
|
+
}
|
|
5985
6072
|
super.dispose();
|
|
5986
6073
|
}
|
|
5987
6074
|
}
|