dockview-core 1.7.2 → 1.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/dockviewPanelApi.d.ts +2 -2
- package/dist/cjs/api/dockviewPanelApi.d.ts.map +1 -1
- package/dist/cjs/api/dockviewPanelApi.js +1 -1
- package/dist/cjs/api/dockviewPanelApi.js.map +1 -1
- package/dist/cjs/api/panelApi.d.ts.map +1 -1
- package/dist/cjs/api/panelApi.js +3 -5
- package/dist/cjs/api/panelApi.js.map +1 -1
- package/dist/cjs/dnd/abstractDragHandler.d.ts.map +1 -1
- package/dist/cjs/dnd/abstractDragHandler.js +1 -0
- package/dist/cjs/dnd/abstractDragHandler.js.map +1 -1
- package/dist/cjs/dnd/droptarget.d.ts.map +1 -1
- package/dist/cjs/dnd/droptarget.js +1 -0
- package/dist/cjs/dnd/droptarget.js.map +1 -1
- package/dist/cjs/dnd/groupDragHandler.d.ts +0 -1
- package/dist/cjs/dnd/groupDragHandler.d.ts.map +1 -1
- package/dist/cjs/dnd/groupDragHandler.js +0 -3
- package/dist/cjs/dnd/groupDragHandler.js.map +1 -1
- package/dist/cjs/dockview/components/panel/content.d.ts.map +1 -1
- package/dist/cjs/dockview/components/panel/content.js +2 -2
- package/dist/cjs/dockview/components/panel/content.js.map +1 -1
- package/dist/cjs/dockview/components/tab/tab.d.ts +2 -2
- package/dist/cjs/dockview/components/tab/tab.d.ts.map +1 -1
- package/dist/cjs/dockview/components/tab/tab.js +2 -7
- package/dist/cjs/dockview/components/tab/tab.js.map +1 -1
- package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts.map +1 -1
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +27 -3
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.js +23 -21
- package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +2 -2
- package/dist/cjs/dockview/dockviewGroupPanelModel.js.map +1 -1
- package/dist/cjs/dockview/dockviewPanel.d.ts +7 -6
- package/dist/cjs/dockview/dockviewPanel.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewPanel.js +37 -12
- package/dist/cjs/dockview/dockviewPanel.js.map +1 -1
- package/dist/cjs/dockview/dockviewPanelModel.d.ts +4 -3
- package/dist/cjs/dockview/dockviewPanelModel.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewPanelModel.js.map +1 -1
- package/dist/cjs/dockview/types.d.ts +1 -5
- package/dist/cjs/dockview/types.d.ts.map +1 -1
- package/dist/cjs/dockview/types.js.map +1 -1
- package/dist/cjs/dom.js +1 -5
- package/dist/cjs/dom.js.map +1 -1
- package/dist/cjs/events.d.ts +17 -0
- package/dist/cjs/events.d.ts.map +1 -1
- package/dist/cjs/events.js +94 -7
- package/dist/cjs/events.js.map +1 -1
- package/dist/cjs/gridview/baseComponentGridview.d.ts.map +1 -1
- package/dist/cjs/gridview/baseComponentGridview.js +2 -3
- package/dist/cjs/gridview/baseComponentGridview.js.map +1 -1
- package/dist/cjs/gridview/basePanelView.d.ts.map +1 -1
- package/dist/cjs/gridview/basePanelView.js +41 -8
- package/dist/cjs/gridview/basePanelView.js.map +1 -1
- package/dist/cjs/gridview/branchNode.d.ts +1 -1
- package/dist/cjs/gridview/branchNode.d.ts.map +1 -1
- package/dist/cjs/gridview/branchNode.js +3 -3
- package/dist/cjs/gridview/branchNode.js.map +1 -1
- package/dist/cjs/gridview/gridview.d.ts.map +1 -1
- package/dist/cjs/gridview/gridview.js +21 -13
- package/dist/cjs/gridview/gridview.js.map +1 -1
- package/dist/cjs/gridview/gridviewPanel.js +2 -2
- package/dist/cjs/gridview/gridviewPanel.js.map +1 -1
- package/dist/cjs/lifecycle.d.ts +1 -1
- package/dist/cjs/lifecycle.d.ts.map +1 -1
- package/dist/cjs/lifecycle.js +3 -3
- package/dist/cjs/lifecycle.js.map +1 -1
- package/dist/cjs/splitview/splitview.d.ts +3 -2
- package/dist/cjs/splitview/splitview.d.ts.map +1 -1
- package/dist/cjs/splitview/splitview.js +103 -84
- package/dist/cjs/splitview/splitview.js.map +1 -1
- package/dist/cjs/splitview/splitviewComponent.d.ts +2 -2
- package/dist/cjs/splitview/splitviewComponent.d.ts.map +1 -1
- package/dist/cjs/splitview/splitviewComponent.js +36 -20
- package/dist/cjs/splitview/splitviewComponent.js.map +1 -1
- package/dist/cjs/splitview/splitviewPanel.d.ts.map +1 -1
- package/dist/cjs/splitview/splitviewPanel.js.map +1 -1
- package/dist/dockview-core.amd.js +284 -196
- package/dist/dockview-core.amd.min.js +2 -2
- package/dist/dockview-core.amd.min.noStyle.js +2 -2
- package/dist/dockview-core.amd.noStyle.js +284 -196
- package/dist/dockview-core.cjs.js +284 -196
- package/dist/dockview-core.esm.js +284 -196
- package/dist/dockview-core.esm.min.js +2 -2
- package/dist/dockview-core.js +284 -196
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.noStyle.js +284 -196
- package/dist/esm/api/dockviewPanelApi.d.ts +2 -2
- package/dist/esm/api/dockviewPanelApi.d.ts.map +1 -1
- package/dist/esm/api/dockviewPanelApi.js +1 -1
- package/dist/esm/api/dockviewPanelApi.js.map +1 -1
- package/dist/esm/api/panelApi.d.ts.map +1 -1
- package/dist/esm/api/panelApi.js +3 -5
- package/dist/esm/api/panelApi.js.map +1 -1
- package/dist/esm/dnd/abstractDragHandler.d.ts.map +1 -1
- package/dist/esm/dnd/abstractDragHandler.js +1 -0
- package/dist/esm/dnd/abstractDragHandler.js.map +1 -1
- package/dist/esm/dnd/droptarget.d.ts.map +1 -1
- package/dist/esm/dnd/droptarget.js +1 -0
- package/dist/esm/dnd/droptarget.js.map +1 -1
- package/dist/esm/dnd/groupDragHandler.d.ts +0 -1
- package/dist/esm/dnd/groupDragHandler.d.ts.map +1 -1
- package/dist/esm/dnd/groupDragHandler.js +0 -3
- package/dist/esm/dnd/groupDragHandler.js.map +1 -1
- package/dist/esm/dockview/components/panel/content.d.ts.map +1 -1
- package/dist/esm/dockview/components/panel/content.js +2 -2
- package/dist/esm/dockview/components/panel/content.js.map +1 -1
- package/dist/esm/dockview/components/tab/tab.d.ts +2 -2
- package/dist/esm/dockview/components/tab/tab.d.ts.map +1 -1
- package/dist/esm/dockview/components/tab/tab.js +2 -7
- package/dist/esm/dockview/components/tab/tab.js.map +1 -1
- package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts.map +1 -1
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +5 -3
- package/dist/esm/dockview/components/titlebar/tabsContainer.js.map +1 -1
- package/dist/esm/dockview/dockviewComponent.d.ts +1 -1
- package/dist/esm/dockview/dockviewComponent.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewComponent.js +23 -21
- package/dist/esm/dockview/dockviewComponent.js.map +1 -1
- package/dist/esm/dockview/dockviewGroupPanelModel.js +2 -2
- package/dist/esm/dockview/dockviewGroupPanelModel.js.map +1 -1
- package/dist/esm/dockview/dockviewPanel.d.ts +7 -6
- package/dist/esm/dockview/dockviewPanel.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewPanel.js +15 -12
- package/dist/esm/dockview/dockviewPanel.js.map +1 -1
- package/dist/esm/dockview/dockviewPanelModel.d.ts +4 -3
- package/dist/esm/dockview/dockviewPanelModel.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewPanelModel.js.map +1 -1
- package/dist/esm/dockview/types.d.ts +1 -5
- package/dist/esm/dockview/types.d.ts.map +1 -1
- package/dist/esm/dockview/types.js.map +1 -1
- package/dist/esm/dom.js +1 -5
- package/dist/esm/dom.js.map +1 -1
- package/dist/esm/events.d.ts +17 -0
- package/dist/esm/events.d.ts.map +1 -1
- package/dist/esm/events.js +75 -7
- package/dist/esm/events.js.map +1 -1
- package/dist/esm/gridview/baseComponentGridview.d.ts.map +1 -1
- package/dist/esm/gridview/baseComponentGridview.js +2 -3
- package/dist/esm/gridview/baseComponentGridview.js.map +1 -1
- package/dist/esm/gridview/basePanelView.d.ts.map +1 -1
- package/dist/esm/gridview/basePanelView.js +16 -5
- package/dist/esm/gridview/basePanelView.js.map +1 -1
- package/dist/esm/gridview/branchNode.d.ts +1 -1
- package/dist/esm/gridview/branchNode.d.ts.map +1 -1
- package/dist/esm/gridview/branchNode.js +3 -3
- package/dist/esm/gridview/branchNode.js.map +1 -1
- package/dist/esm/gridview/gridview.d.ts.map +1 -1
- package/dist/esm/gridview/gridview.js +19 -11
- package/dist/esm/gridview/gridview.js.map +1 -1
- package/dist/esm/gridview/gridviewPanel.js +2 -2
- package/dist/esm/gridview/gridviewPanel.js.map +1 -1
- package/dist/esm/lifecycle.d.ts +1 -1
- package/dist/esm/lifecycle.d.ts.map +1 -1
- package/dist/esm/lifecycle.js +3 -3
- package/dist/esm/lifecycle.js.map +1 -1
- package/dist/esm/splitview/splitview.d.ts +3 -2
- package/dist/esm/splitview/splitview.d.ts.map +1 -1
- package/dist/esm/splitview/splitview.js +90 -84
- package/dist/esm/splitview/splitview.js.map +1 -1
- package/dist/esm/splitview/splitviewComponent.d.ts +2 -2
- package/dist/esm/splitview/splitviewComponent.d.ts.map +1 -1
- package/dist/esm/splitview/splitviewComponent.js +22 -16
- package/dist/esm/splitview/splitviewComponent.js.map +1 -1
- package/dist/esm/splitview/splitviewPanel.d.ts.map +1 -1
- package/dist/esm/splitview/splitviewPanel.js.map +1 -1
- package/package.json +2 -2
|
@@ -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
|
*/
|
|
@@ -121,9 +121,49 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
121
121
|
};
|
|
122
122
|
};
|
|
123
123
|
})(exports.DockviewEvent || (exports.DockviewEvent = {}));
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
class LeakageMonitor {
|
|
125
|
+
constructor() {
|
|
126
|
+
this.events = new Map();
|
|
127
|
+
}
|
|
128
|
+
get size() {
|
|
129
|
+
return this.events.size;
|
|
130
|
+
}
|
|
131
|
+
add(event, stacktrace) {
|
|
132
|
+
this.events.set(event, stacktrace);
|
|
133
|
+
}
|
|
134
|
+
delete(event) {
|
|
135
|
+
this.events.delete(event);
|
|
136
|
+
}
|
|
137
|
+
clear() {
|
|
138
|
+
this.events.clear();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
class Stacktrace {
|
|
142
|
+
static create() {
|
|
143
|
+
var _a;
|
|
144
|
+
return new Stacktrace((_a = new Error().stack) !== null && _a !== void 0 ? _a : '');
|
|
145
|
+
}
|
|
146
|
+
constructor(value) {
|
|
147
|
+
this.value = value;
|
|
148
|
+
}
|
|
149
|
+
print() {
|
|
150
|
+
console.warn(this.value);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
class Listener {
|
|
154
|
+
constructor(callback, stacktrace) {
|
|
155
|
+
this.callback = callback;
|
|
156
|
+
this.stacktrace = stacktrace;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// relatively simple event emitter taken from https://github.com/microsoft/vscode/blob/master/src/vs/base/common/event.ts
|
|
126
160
|
class Emitter {
|
|
161
|
+
static setLeakageMonitorEnabled(isEnabled) {
|
|
162
|
+
if (isEnabled !== Emitter.ENABLE_TRACKING) {
|
|
163
|
+
Emitter.MEMORY_LEAK_WATCHER.clear();
|
|
164
|
+
}
|
|
165
|
+
Emitter.ENABLE_TRACKING = isEnabled;
|
|
166
|
+
}
|
|
127
167
|
constructor(options) {
|
|
128
168
|
this.options = options;
|
|
129
169
|
this._listeners = [];
|
|
@@ -131,11 +171,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
131
171
|
}
|
|
132
172
|
get event() {
|
|
133
173
|
if (!this._event) {
|
|
134
|
-
this._event = (
|
|
174
|
+
this._event = (callback) => {
|
|
135
175
|
var _a;
|
|
136
176
|
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) && this._last !== undefined) {
|
|
137
|
-
|
|
177
|
+
callback(this._last);
|
|
138
178
|
}
|
|
179
|
+
const listener = new Listener(callback, Emitter.ENABLE_TRACKING ? Stacktrace.create() : undefined);
|
|
139
180
|
this._listeners.push(listener);
|
|
140
181
|
return {
|
|
141
182
|
dispose: () => {
|
|
@@ -143,23 +184,45 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
143
184
|
if (index > -1) {
|
|
144
185
|
this._listeners.splice(index, 1);
|
|
145
186
|
}
|
|
187
|
+
else if (Emitter.ENABLE_TRACKING) ;
|
|
146
188
|
},
|
|
147
189
|
};
|
|
148
190
|
};
|
|
191
|
+
if (Emitter.ENABLE_TRACKING) {
|
|
192
|
+
Emitter.MEMORY_LEAK_WATCHER.add(this._event, Stacktrace.create());
|
|
193
|
+
}
|
|
149
194
|
}
|
|
150
195
|
return this._event;
|
|
151
196
|
}
|
|
152
197
|
fire(e) {
|
|
153
198
|
this._last = e;
|
|
154
199
|
for (const listener of this._listeners) {
|
|
155
|
-
listener(e);
|
|
200
|
+
listener.callback(e);
|
|
156
201
|
}
|
|
157
202
|
}
|
|
158
203
|
dispose() {
|
|
159
|
-
this.
|
|
160
|
-
|
|
204
|
+
if (!this._disposed) {
|
|
205
|
+
this._disposed = true;
|
|
206
|
+
if (this._listeners.length > 0) {
|
|
207
|
+
if (Emitter.ENABLE_TRACKING) {
|
|
208
|
+
queueMicrotask(() => {
|
|
209
|
+
var _a;
|
|
210
|
+
// don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block
|
|
211
|
+
for (const listener of this._listeners) {
|
|
212
|
+
console.warn((_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
this._listeners = [];
|
|
217
|
+
}
|
|
218
|
+
if (Emitter.ENABLE_TRACKING && this._event) {
|
|
219
|
+
Emitter.MEMORY_LEAK_WATCHER.delete(this._event);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
161
222
|
}
|
|
162
223
|
}
|
|
224
|
+
Emitter.ENABLE_TRACKING = false;
|
|
225
|
+
Emitter.MEMORY_LEAK_WATCHER = new LeakageMonitor();
|
|
163
226
|
function addDisposableWindowListener(element, type, listener, options) {
|
|
164
227
|
element.addEventListener(type, listener, options);
|
|
165
228
|
return {
|
|
@@ -212,13 +275,13 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
212
275
|
}
|
|
213
276
|
constructor(...args) {
|
|
214
277
|
this._isDisposed = false;
|
|
215
|
-
this.
|
|
278
|
+
this._disposables = args;
|
|
216
279
|
}
|
|
217
280
|
addDisposables(...args) {
|
|
218
|
-
args.forEach((arg) => this.
|
|
281
|
+
args.forEach((arg) => this._disposables.push(arg));
|
|
219
282
|
}
|
|
220
283
|
dispose() {
|
|
221
|
-
this.
|
|
284
|
+
this._disposables.forEach((arg) => arg.dispose());
|
|
222
285
|
this._isDisposed = true;
|
|
223
286
|
}
|
|
224
287
|
}
|
|
@@ -308,6 +371,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
308
371
|
this.onDidFocus = this._onDidFocus.event;
|
|
309
372
|
this._onDidBlur = new Emitter();
|
|
310
373
|
this.onDidBlur = this._onDidBlur.event;
|
|
374
|
+
this.addDisposables(this._onDidFocus, this._onDidBlur);
|
|
311
375
|
let hasFocus = isAncestor(document.activeElement, element);
|
|
312
376
|
let loosingFocus = false;
|
|
313
377
|
const onFocus = () => {
|
|
@@ -352,11 +416,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
352
416
|
refreshState() {
|
|
353
417
|
this._refreshStateHandler();
|
|
354
418
|
}
|
|
355
|
-
dispose() {
|
|
356
|
-
super.dispose();
|
|
357
|
-
this._onDidBlur.dispose();
|
|
358
|
-
this._onDidFocus.dispose();
|
|
359
|
-
}
|
|
360
419
|
}
|
|
361
420
|
|
|
362
421
|
function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
|
|
@@ -585,7 +644,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
585
644
|
this._orthogonalSize = value;
|
|
586
645
|
}
|
|
587
646
|
get length() {
|
|
588
|
-
return this.
|
|
647
|
+
return this.viewItems.length;
|
|
589
648
|
}
|
|
590
649
|
get proportions() {
|
|
591
650
|
return this._proportions ? [...this._proportions] : undefined;
|
|
@@ -604,12 +663,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
604
663
|
: 'vertical');
|
|
605
664
|
}
|
|
606
665
|
get minimumSize() {
|
|
607
|
-
return this.
|
|
666
|
+
return this.viewItems.reduce((r, item) => r + item.minimumSize, 0);
|
|
608
667
|
}
|
|
609
668
|
get maximumSize() {
|
|
610
669
|
return this.length === 0
|
|
611
670
|
? Number.POSITIVE_INFINITY
|
|
612
|
-
: this.
|
|
671
|
+
: this.viewItems.reduce((r, item) => r + item.maximumSize, 0);
|
|
613
672
|
}
|
|
614
673
|
get startSnappingEnabled() {
|
|
615
674
|
return this._startSnappingEnabled;
|
|
@@ -633,7 +692,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
633
692
|
}
|
|
634
693
|
constructor(container, options) {
|
|
635
694
|
this.container = container;
|
|
636
|
-
this.
|
|
695
|
+
this.viewItems = [];
|
|
637
696
|
this.sashes = [];
|
|
638
697
|
this._size = 0;
|
|
639
698
|
this._orthogonalSize = 0;
|
|
@@ -647,12 +706,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
647
706
|
this.onDidAddView = this._onDidAddView.event;
|
|
648
707
|
this._onDidRemoveView = new Emitter();
|
|
649
708
|
this.onDidRemoveView = this._onDidRemoveView.event;
|
|
650
|
-
this.resize = (index, delta, sizes = this.
|
|
651
|
-
if (index < 0 || index > this.
|
|
709
|
+
this.resize = (index, delta, sizes = this.viewItems.map((x) => x.size), lowPriorityIndexes, highPriorityIndexes, overloadMinDelta = Number.NEGATIVE_INFINITY, overloadMaxDelta = Number.POSITIVE_INFINITY, snapBefore, snapAfter) => {
|
|
710
|
+
if (index < 0 || index > this.viewItems.length) {
|
|
652
711
|
return 0;
|
|
653
712
|
}
|
|
654
713
|
const upIndexes = range(index, -1);
|
|
655
|
-
const downIndexes = range(index + 1, this.
|
|
714
|
+
const downIndexes = range(index + 1, this.viewItems.length);
|
|
656
715
|
//
|
|
657
716
|
if (highPriorityIndexes) {
|
|
658
717
|
for (const i of highPriorityIndexes) {
|
|
@@ -667,34 +726,34 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
667
726
|
}
|
|
668
727
|
}
|
|
669
728
|
//
|
|
670
|
-
const upItems = upIndexes.map((i) => this.
|
|
729
|
+
const upItems = upIndexes.map((i) => this.viewItems[i]);
|
|
671
730
|
const upSizes = upIndexes.map((i) => sizes[i]);
|
|
672
731
|
//
|
|
673
|
-
const downItems = downIndexes.map((i) => this.
|
|
732
|
+
const downItems = downIndexes.map((i) => this.viewItems[i]);
|
|
674
733
|
const downSizes = downIndexes.map((i) => sizes[i]);
|
|
675
734
|
//
|
|
676
|
-
const minDeltaUp = upIndexes.reduce((_, i) => _ + this.
|
|
677
|
-
const maxDeltaUp = upIndexes.reduce((_, i) => _ + this.
|
|
735
|
+
const minDeltaUp = upIndexes.reduce((_, i) => _ + this.viewItems[i].minimumSize - sizes[i], 0);
|
|
736
|
+
const maxDeltaUp = upIndexes.reduce((_, i) => _ + this.viewItems[i].maximumSize - sizes[i], 0);
|
|
678
737
|
//
|
|
679
738
|
const maxDeltaDown = downIndexes.length === 0
|
|
680
739
|
? Number.POSITIVE_INFINITY
|
|
681
|
-
: downIndexes.reduce((_, i) => _ + sizes[i] - this.
|
|
740
|
+
: downIndexes.reduce((_, i) => _ + sizes[i] - this.viewItems[i].minimumSize, 0);
|
|
682
741
|
const minDeltaDown = downIndexes.length === 0
|
|
683
742
|
? Number.NEGATIVE_INFINITY
|
|
684
|
-
: downIndexes.reduce((_, i) => _ + sizes[i] - this.
|
|
743
|
+
: downIndexes.reduce((_, i) => _ + sizes[i] - this.viewItems[i].maximumSize, 0);
|
|
685
744
|
//
|
|
686
745
|
const minDelta = Math.max(minDeltaUp, minDeltaDown);
|
|
687
746
|
const maxDelta = Math.min(maxDeltaDown, maxDeltaUp);
|
|
688
747
|
//
|
|
689
748
|
let snapped = false;
|
|
690
749
|
if (snapBefore) {
|
|
691
|
-
const snapView = this.
|
|
750
|
+
const snapView = this.viewItems[snapBefore.index];
|
|
692
751
|
const visible = delta >= snapBefore.limitDelta;
|
|
693
752
|
snapped = visible !== snapView.visible;
|
|
694
753
|
snapView.setVisible(visible, snapBefore.size);
|
|
695
754
|
}
|
|
696
755
|
if (!snapped && snapAfter) {
|
|
697
|
-
const snapView = this.
|
|
756
|
+
const snapView = this.viewItems[snapAfter.index];
|
|
698
757
|
const visible = delta < snapAfter.limitDelta;
|
|
699
758
|
snapped = visible !== snapView.visible;
|
|
700
759
|
snapView.setVisible(visible, snapAfter.size);
|
|
@@ -756,7 +815,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
756
815
|
);
|
|
757
816
|
});
|
|
758
817
|
// Initialize content size and proportions for first layout
|
|
759
|
-
this.contentSize = this.
|
|
818
|
+
this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
760
819
|
this.saveProportions();
|
|
761
820
|
}
|
|
762
821
|
}
|
|
@@ -773,18 +832,18 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
773
832
|
}
|
|
774
833
|
}
|
|
775
834
|
isViewVisible(index) {
|
|
776
|
-
if (index < 0 || index >= this.
|
|
835
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
777
836
|
throw new Error('Index out of bounds');
|
|
778
837
|
}
|
|
779
|
-
const viewItem = this.
|
|
838
|
+
const viewItem = this.viewItems[index];
|
|
780
839
|
return viewItem.visible;
|
|
781
840
|
}
|
|
782
841
|
setViewVisible(index, visible) {
|
|
783
|
-
if (index < 0 || index >= this.
|
|
842
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
784
843
|
throw new Error('Index out of bounds');
|
|
785
844
|
}
|
|
786
845
|
toggleClass(this.container, 'visible', visible);
|
|
787
|
-
const viewItem = this.
|
|
846
|
+
const viewItem = this.viewItems[index];
|
|
788
847
|
toggleClass(this.container, 'visible', visible);
|
|
789
848
|
viewItem.setVisible(visible, viewItem.size);
|
|
790
849
|
this.distributeEmptySpace(index);
|
|
@@ -792,33 +851,33 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
792
851
|
this.saveProportions();
|
|
793
852
|
}
|
|
794
853
|
getViewSize(index) {
|
|
795
|
-
if (index < 0 || index >= this.
|
|
854
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
796
855
|
return -1;
|
|
797
856
|
}
|
|
798
|
-
return this.
|
|
857
|
+
return this.viewItems[index].size;
|
|
799
858
|
}
|
|
800
859
|
resizeView(index, size) {
|
|
801
|
-
if (index < 0 || index >= this.
|
|
860
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
802
861
|
return;
|
|
803
862
|
}
|
|
804
|
-
const indexes = range(this.
|
|
863
|
+
const indexes = range(this.viewItems.length).filter((i) => i !== index);
|
|
805
864
|
const lowPriorityIndexes = [
|
|
806
|
-
...indexes.filter((i) => this.
|
|
865
|
+
...indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low),
|
|
807
866
|
index,
|
|
808
867
|
];
|
|
809
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
810
|
-
const item = this.
|
|
868
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
869
|
+
const item = this.viewItems[index];
|
|
811
870
|
size = Math.round(size);
|
|
812
871
|
size = clamp(size, item.minimumSize, Math.min(item.maximumSize, this._size));
|
|
813
872
|
item.size = size;
|
|
814
873
|
this.relayout(lowPriorityIndexes, highPriorityIndexes);
|
|
815
874
|
}
|
|
816
875
|
getViews() {
|
|
817
|
-
return this.
|
|
876
|
+
return this.viewItems.map((x) => x.view);
|
|
818
877
|
}
|
|
819
878
|
onDidChange(item, size) {
|
|
820
|
-
const index = this.
|
|
821
|
-
if (index < 0 || index >= this.
|
|
879
|
+
const index = this.viewItems.indexOf(item);
|
|
880
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
822
881
|
return;
|
|
823
882
|
}
|
|
824
883
|
size = typeof size === 'number' ? size : item.size;
|
|
@@ -826,7 +885,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
826
885
|
item.size = size;
|
|
827
886
|
this.relayout([index]);
|
|
828
887
|
}
|
|
829
|
-
addView(view, size = { type: 'distribute' }, index = this.
|
|
888
|
+
addView(view, size = { type: 'distribute' }, index = this.viewItems.length, skipLayout) {
|
|
830
889
|
const container = document.createElement('div');
|
|
831
890
|
container.className = 'view';
|
|
832
891
|
container.appendChild(view.element);
|
|
@@ -844,24 +903,25 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
844
903
|
viewSize = view.minimumSize;
|
|
845
904
|
}
|
|
846
905
|
const disposable = view.onDidChange((newSize) => this.onDidChange(viewItem, newSize.size));
|
|
847
|
-
const
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
906
|
+
const viewItem = new ViewItem(container, view, viewSize, {
|
|
907
|
+
dispose: () => {
|
|
908
|
+
disposable.dispose();
|
|
909
|
+
this.viewContainer.removeChild(container);
|
|
910
|
+
},
|
|
911
|
+
});
|
|
912
|
+
if (index === this.viewItems.length) {
|
|
853
913
|
this.viewContainer.appendChild(container);
|
|
854
914
|
}
|
|
855
915
|
else {
|
|
856
916
|
this.viewContainer.insertBefore(container, this.viewContainer.children.item(index));
|
|
857
917
|
}
|
|
858
|
-
this.
|
|
859
|
-
if (this.
|
|
918
|
+
this.viewItems.splice(index, 0, viewItem);
|
|
919
|
+
if (this.viewItems.length > 1) {
|
|
860
920
|
//add sash
|
|
861
921
|
const sash = document.createElement('div');
|
|
862
922
|
sash.className = 'sash';
|
|
863
923
|
const onStart = (event) => {
|
|
864
|
-
for (const item of this.
|
|
924
|
+
for (const item of this.viewItems) {
|
|
865
925
|
item.enabled = false;
|
|
866
926
|
}
|
|
867
927
|
const iframes = [
|
|
@@ -876,27 +936,29 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
876
936
|
: event.clientY;
|
|
877
937
|
const sashIndex = firstIndex(this.sashes, (s) => s.container === sash);
|
|
878
938
|
//
|
|
879
|
-
const sizes = this.
|
|
939
|
+
const sizes = this.viewItems.map((x) => x.size);
|
|
880
940
|
//
|
|
881
941
|
let snapBefore;
|
|
882
942
|
let snapAfter;
|
|
883
943
|
const upIndexes = range(sashIndex, -1);
|
|
884
|
-
const downIndexes = range(sashIndex + 1, this.
|
|
885
|
-
const minDeltaUp = upIndexes.reduce((r, i) => r + (this.
|
|
886
|
-
const maxDeltaUp = upIndexes.reduce((r, i) => r + (this.
|
|
944
|
+
const downIndexes = range(sashIndex + 1, this.viewItems.length);
|
|
945
|
+
const minDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].minimumSize - sizes[i]), 0);
|
|
946
|
+
const maxDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].viewMaximumSize - sizes[i]), 0);
|
|
887
947
|
const maxDeltaDown = downIndexes.length === 0
|
|
888
948
|
? Number.POSITIVE_INFINITY
|
|
889
|
-
: downIndexes.reduce((r, i) => r +
|
|
949
|
+
: downIndexes.reduce((r, i) => r +
|
|
950
|
+
(sizes[i] - this.viewItems[i].minimumSize), 0);
|
|
890
951
|
const minDeltaDown = downIndexes.length === 0
|
|
891
952
|
? Number.NEGATIVE_INFINITY
|
|
892
953
|
: downIndexes.reduce((r, i) => r +
|
|
893
|
-
(sizes[i] -
|
|
954
|
+
(sizes[i] -
|
|
955
|
+
this.viewItems[i].viewMaximumSize), 0);
|
|
894
956
|
const minDelta = Math.max(minDeltaUp, minDeltaDown);
|
|
895
957
|
const maxDelta = Math.min(maxDeltaDown, maxDeltaUp);
|
|
896
958
|
const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);
|
|
897
959
|
const snapAfterIndex = this.findFirstSnapIndex(downIndexes);
|
|
898
960
|
if (typeof snapBeforeIndex === 'number') {
|
|
899
|
-
const snappedViewItem = this.
|
|
961
|
+
const snappedViewItem = this.viewItems[snapBeforeIndex];
|
|
900
962
|
const halfSize = Math.floor(snappedViewItem.viewMinimumSize / 2);
|
|
901
963
|
snapBefore = {
|
|
902
964
|
index: snapBeforeIndex,
|
|
@@ -907,7 +969,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
907
969
|
};
|
|
908
970
|
}
|
|
909
971
|
if (typeof snapAfterIndex === 'number') {
|
|
910
|
-
const snappedViewItem = this.
|
|
972
|
+
const snappedViewItem = this.viewItems[snapAfterIndex];
|
|
911
973
|
const halfSize = Math.floor(snappedViewItem.viewMinimumSize / 2);
|
|
912
974
|
snapAfter = {
|
|
913
975
|
index: snapAfterIndex,
|
|
@@ -928,7 +990,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
928
990
|
this.layoutViews();
|
|
929
991
|
};
|
|
930
992
|
const end = () => {
|
|
931
|
-
for (const item of this.
|
|
993
|
+
for (const item of this.viewItems) {
|
|
932
994
|
item.enabled = true;
|
|
933
995
|
}
|
|
934
996
|
for (const iframe of iframes) {
|
|
@@ -968,7 +1030,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
968
1030
|
distributeViewSizes() {
|
|
969
1031
|
const flexibleViewItems = [];
|
|
970
1032
|
let flexibleSize = 0;
|
|
971
|
-
for (const item of this.
|
|
1033
|
+
for (const item of this.viewItems) {
|
|
972
1034
|
if (item.maximumSize - item.minimumSize > 0) {
|
|
973
1035
|
flexibleViewItems.push(item);
|
|
974
1036
|
flexibleSize += item.size;
|
|
@@ -978,17 +1040,17 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
978
1040
|
for (const item of flexibleViewItems) {
|
|
979
1041
|
item.size = clamp(size, item.minimumSize, item.maximumSize);
|
|
980
1042
|
}
|
|
981
|
-
const indexes = range(this.
|
|
982
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
983
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1043
|
+
const indexes = range(this.viewItems.length);
|
|
1044
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1045
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
984
1046
|
this.relayout(lowPriorityIndexes, highPriorityIndexes);
|
|
985
1047
|
}
|
|
986
1048
|
removeView(index, sizing, skipLayout = false) {
|
|
987
1049
|
// Remove view
|
|
988
|
-
const viewItem = this.
|
|
1050
|
+
const viewItem = this.viewItems.splice(index, 1)[0];
|
|
989
1051
|
viewItem.dispose();
|
|
990
1052
|
// Remove sash
|
|
991
|
-
if (this.
|
|
1053
|
+
if (this.viewItems.length >= 1) {
|
|
992
1054
|
const sashIndex = Math.max(index - 1, 0);
|
|
993
1055
|
const sashItem = this.sashes.splice(sashIndex, 1)[0];
|
|
994
1056
|
sashItem.disposable();
|
|
@@ -1003,10 +1065,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1003
1065
|
return viewItem.view;
|
|
1004
1066
|
}
|
|
1005
1067
|
getViewCachedVisibleSize(index) {
|
|
1006
|
-
if (index < 0 || index >= this.
|
|
1068
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
1007
1069
|
throw new Error('Index out of bounds');
|
|
1008
1070
|
}
|
|
1009
|
-
const viewItem = this.
|
|
1071
|
+
const viewItem = this.viewItems[index];
|
|
1010
1072
|
return viewItem.cachedVisibleSize;
|
|
1011
1073
|
}
|
|
1012
1074
|
moveView(from, to) {
|
|
@@ -1022,14 +1084,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1022
1084
|
this.size = size;
|
|
1023
1085
|
this.orthogonalSize = orthogonalSize;
|
|
1024
1086
|
if (!this.proportions) {
|
|
1025
|
-
const indexes = range(this.
|
|
1026
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
1027
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1028
|
-
this.resize(this.
|
|
1087
|
+
const indexes = range(this.viewItems.length);
|
|
1088
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1089
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1090
|
+
this.resize(this.viewItems.length - 1, size - previousSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
1029
1091
|
}
|
|
1030
1092
|
else {
|
|
1031
|
-
for (let i = 0; i < this.
|
|
1032
|
-
const item = this.
|
|
1093
|
+
for (let i = 0; i < this.viewItems.length; i++) {
|
|
1094
|
+
const item = this.viewItems[i];
|
|
1033
1095
|
item.size = clamp(Math.round(this.proportions[i] * size), item.minimumSize, item.maximumSize);
|
|
1034
1096
|
}
|
|
1035
1097
|
}
|
|
@@ -1037,18 +1099,18 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1037
1099
|
this.layoutViews();
|
|
1038
1100
|
}
|
|
1039
1101
|
relayout(lowPriorityIndexes, highPriorityIndexes) {
|
|
1040
|
-
const contentSize = this.
|
|
1041
|
-
this.resize(this.
|
|
1102
|
+
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1103
|
+
this.resize(this.viewItems.length - 1, this._size - contentSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
1042
1104
|
this.distributeEmptySpace();
|
|
1043
1105
|
this.layoutViews();
|
|
1044
1106
|
this.saveProportions();
|
|
1045
1107
|
}
|
|
1046
1108
|
distributeEmptySpace(lowPriorityIndex) {
|
|
1047
|
-
const contentSize = this.
|
|
1109
|
+
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1048
1110
|
let emptyDelta = this.size - contentSize;
|
|
1049
|
-
const indexes = range(this.
|
|
1050
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
1051
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1111
|
+
const indexes = range(this.viewItems.length - 1, -1);
|
|
1112
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1113
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1052
1114
|
for (const index of highPriorityIndexes) {
|
|
1053
1115
|
pushToStart(indexes, index);
|
|
1054
1116
|
}
|
|
@@ -1059,7 +1121,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1059
1121
|
pushToEnd(indexes, lowPriorityIndex);
|
|
1060
1122
|
}
|
|
1061
1123
|
for (let i = 0; emptyDelta !== 0 && i < indexes.length; i++) {
|
|
1062
|
-
const item = this.
|
|
1124
|
+
const item = this.viewItems[indexes[i]];
|
|
1063
1125
|
const size = clamp(item.size + emptyDelta, item.minimumSize, item.maximumSize);
|
|
1064
1126
|
const viewDelta = size - item.size;
|
|
1065
1127
|
emptyDelta -= viewDelta;
|
|
@@ -1068,16 +1130,16 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1068
1130
|
}
|
|
1069
1131
|
saveProportions() {
|
|
1070
1132
|
if (this.proportionalLayout && this.contentSize > 0) {
|
|
1071
|
-
this._proportions = this.
|
|
1133
|
+
this._proportions = this.viewItems.map((i) => i.size / this.contentSize);
|
|
1072
1134
|
}
|
|
1073
1135
|
}
|
|
1074
1136
|
layoutViews() {
|
|
1075
|
-
this.contentSize = this.
|
|
1137
|
+
this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1076
1138
|
let sum = 0;
|
|
1077
1139
|
const x = [];
|
|
1078
1140
|
this.updateSashEnablement();
|
|
1079
|
-
for (let i = 0; i < this.
|
|
1080
|
-
sum += this.
|
|
1141
|
+
for (let i = 0; i < this.viewItems.length - 1; i++) {
|
|
1142
|
+
sum += this.viewItems[i].size;
|
|
1081
1143
|
x.push(sum);
|
|
1082
1144
|
const offset = Math.min(Math.max(0, sum - 2), this.size - 4);
|
|
1083
1145
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
@@ -1089,7 +1151,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1089
1151
|
this.sashes[i].container.style.top = `${offset}px`;
|
|
1090
1152
|
}
|
|
1091
1153
|
}
|
|
1092
|
-
this.
|
|
1154
|
+
this.viewItems.forEach((view, i) => {
|
|
1093
1155
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
1094
1156
|
view.container.style.width = `${view.size}px`;
|
|
1095
1157
|
view.container.style.left = i == 0 ? '0px' : `${x[i - 1]}px`;
|
|
@@ -1108,7 +1170,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1108
1170
|
findFirstSnapIndex(indexes) {
|
|
1109
1171
|
// visible views first
|
|
1110
1172
|
for (const index of indexes) {
|
|
1111
|
-
const viewItem = this.
|
|
1173
|
+
const viewItem = this.viewItems[index];
|
|
1112
1174
|
if (!viewItem.visible) {
|
|
1113
1175
|
continue;
|
|
1114
1176
|
}
|
|
@@ -1118,7 +1180,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1118
1180
|
}
|
|
1119
1181
|
// then, hidden views
|
|
1120
1182
|
for (const index of indexes) {
|
|
1121
|
-
const viewItem = this.
|
|
1183
|
+
const viewItem = this.viewItems[index];
|
|
1122
1184
|
if (viewItem.visible &&
|
|
1123
1185
|
viewItem.maximumSize - viewItem.minimumSize > 0) {
|
|
1124
1186
|
return undefined;
|
|
@@ -1131,10 +1193,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1131
1193
|
}
|
|
1132
1194
|
updateSashEnablement() {
|
|
1133
1195
|
let previous = false;
|
|
1134
|
-
const collapsesDown = this.
|
|
1196
|
+
const collapsesDown = this.viewItems.map((i) => (previous = i.size - i.minimumSize > 0 || previous));
|
|
1135
1197
|
previous = false;
|
|
1136
|
-
const expandsDown = this.
|
|
1137
|
-
const reverseViews = [...this.
|
|
1198
|
+
const expandsDown = this.viewItems.map((i) => (previous = i.maximumSize - i.size > 0 || previous));
|
|
1199
|
+
const reverseViews = [...this.viewItems].reverse();
|
|
1138
1200
|
previous = false;
|
|
1139
1201
|
const collapsesUp = reverseViews
|
|
1140
1202
|
.map((i) => (previous = i.size - i.minimumSize > 0 || previous))
|
|
@@ -1146,19 +1208,19 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1146
1208
|
let position = 0;
|
|
1147
1209
|
for (let index = 0; index < this.sashes.length; index++) {
|
|
1148
1210
|
const sash = this.sashes[index];
|
|
1149
|
-
const viewItem = this.
|
|
1211
|
+
const viewItem = this.viewItems[index];
|
|
1150
1212
|
position += viewItem.size;
|
|
1151
1213
|
const min = !(collapsesDown[index] && expandsUp[index + 1]);
|
|
1152
1214
|
const max = !(expandsDown[index] && collapsesUp[index + 1]);
|
|
1153
1215
|
if (min && max) {
|
|
1154
1216
|
const upIndexes = range(index, -1);
|
|
1155
|
-
const downIndexes = range(index + 1, this.
|
|
1217
|
+
const downIndexes = range(index + 1, this.viewItems.length);
|
|
1156
1218
|
const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);
|
|
1157
1219
|
const snapAfterIndex = this.findFirstSnapIndex(downIndexes);
|
|
1158
1220
|
const snappedBefore = typeof snapBeforeIndex === 'number' &&
|
|
1159
|
-
!this.
|
|
1221
|
+
!this.viewItems[snapBeforeIndex].visible;
|
|
1160
1222
|
const snappedAfter = typeof snapAfterIndex === 'number' &&
|
|
1161
|
-
!this.
|
|
1223
|
+
!this.viewItems[snapAfterIndex].visible;
|
|
1162
1224
|
if (snappedBefore &&
|
|
1163
1225
|
collapsesUp[index] &&
|
|
1164
1226
|
(position > 0 || this.startSnappingEnabled)) {
|
|
@@ -1218,6 +1280,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1218
1280
|
break;
|
|
1219
1281
|
}
|
|
1220
1282
|
}
|
|
1283
|
+
for (const viewItem of this.viewItems) {
|
|
1284
|
+
viewItem.dispose();
|
|
1285
|
+
}
|
|
1221
1286
|
this.element.remove();
|
|
1222
1287
|
}
|
|
1223
1288
|
}
|
|
@@ -1652,7 +1717,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1652
1717
|
throw new Error('Invalid index');
|
|
1653
1718
|
}
|
|
1654
1719
|
this.splitview.removeView(index, sizing);
|
|
1655
|
-
this._removeChild(index);
|
|
1720
|
+
return this._removeChild(index);
|
|
1656
1721
|
}
|
|
1657
1722
|
_addChild(node, index) {
|
|
1658
1723
|
this.children.splice(index, 0, node);
|
|
@@ -1674,10 +1739,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1674
1739
|
});
|
|
1675
1740
|
}
|
|
1676
1741
|
dispose() {
|
|
1677
|
-
super.dispose();
|
|
1678
1742
|
this._childrenDisposable.dispose();
|
|
1679
|
-
this.children.forEach((child) => child.dispose());
|
|
1680
1743
|
this.splitview.dispose();
|
|
1744
|
+
this.children.forEach((child) => child.dispose());
|
|
1745
|
+
super.dispose();
|
|
1681
1746
|
}
|
|
1682
1747
|
}
|
|
1683
1748
|
|
|
@@ -1907,7 +1972,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1907
1972
|
if (oldRoot.children.length === 1) {
|
|
1908
1973
|
// can remove one level of redundant branching if there is only a single child
|
|
1909
1974
|
const childReference = oldRoot.children[0];
|
|
1910
|
-
oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
1975
|
+
const child = oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
1976
|
+
child.dispose();
|
|
1911
1977
|
oldRoot.dispose();
|
|
1912
1978
|
this._root.addChild(
|
|
1913
1979
|
/**
|
|
@@ -2014,7 +2080,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2014
2080
|
if (typeof newSiblingCachedVisibleSize === 'number') {
|
|
2015
2081
|
newSiblingSize = exports.Sizing.Invisible(newSiblingCachedVisibleSize);
|
|
2016
2082
|
}
|
|
2017
|
-
grandParent.removeChild(parentIndex);
|
|
2083
|
+
const child = grandParent.removeChild(parentIndex);
|
|
2084
|
+
child.dispose();
|
|
2018
2085
|
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize);
|
|
2019
2086
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
2020
2087
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
@@ -2040,30 +2107,36 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2040
2107
|
if (!(node instanceof LeafNode)) {
|
|
2041
2108
|
throw new Error('Invalid location');
|
|
2042
2109
|
}
|
|
2043
|
-
|
|
2110
|
+
const view = node.view;
|
|
2111
|
+
node.dispose(); // dispose of node
|
|
2112
|
+
const child = parent.removeChild(index, sizing);
|
|
2113
|
+
child.dispose();
|
|
2044
2114
|
if (parent.children.length === 0) {
|
|
2045
|
-
return
|
|
2115
|
+
return view;
|
|
2046
2116
|
}
|
|
2047
2117
|
if (parent.children.length > 1) {
|
|
2048
|
-
return
|
|
2118
|
+
return view;
|
|
2049
2119
|
}
|
|
2050
2120
|
const sibling = parent.children[0];
|
|
2051
2121
|
if (pathToParent.length === 0) {
|
|
2052
2122
|
// parent is root
|
|
2053
2123
|
if (sibling instanceof LeafNode) {
|
|
2054
|
-
return
|
|
2124
|
+
return view;
|
|
2055
2125
|
}
|
|
2056
2126
|
// we must promote sibling to be the new root
|
|
2057
|
-
parent.removeChild(0, sizing);
|
|
2127
|
+
const child = parent.removeChild(0, sizing);
|
|
2128
|
+
child.dispose();
|
|
2058
2129
|
this.root = sibling;
|
|
2059
|
-
return
|
|
2130
|
+
return view;
|
|
2060
2131
|
}
|
|
2061
2132
|
const [grandParent, ..._] = [...pathToParent].reverse();
|
|
2062
2133
|
const [parentIndex, ...__] = [...rest].reverse();
|
|
2063
2134
|
const isSiblingVisible = parent.isChildVisible(0);
|
|
2064
|
-
parent.removeChild(0, sizing);
|
|
2135
|
+
const childNode = parent.removeChild(0, sizing);
|
|
2136
|
+
childNode.dispose();
|
|
2065
2137
|
const sizes = grandParent.children.map((_size, i) => grandParent.getChildSize(i));
|
|
2066
|
-
grandParent.removeChild(parentIndex, sizing);
|
|
2138
|
+
const parentNode = grandParent.removeChild(parentIndex, sizing);
|
|
2139
|
+
parentNode.dispose();
|
|
2067
2140
|
if (sibling instanceof BranchNode) {
|
|
2068
2141
|
sizes.splice(parentIndex, 1, ...sibling.children.map((c) => c.size));
|
|
2069
2142
|
for (let i = 0; i < sibling.children.length; i++) {
|
|
@@ -2081,7 +2154,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2081
2154
|
for (let i = 0; i < sizes.length; i++) {
|
|
2082
2155
|
grandParent.resizeChild(i, sizes[i]);
|
|
2083
2156
|
}
|
|
2084
|
-
return
|
|
2157
|
+
return view;
|
|
2085
2158
|
}
|
|
2086
2159
|
layout(width, height) {
|
|
2087
2160
|
const [size, orthogonalSize] = this.root.orientation === exports.Orientation.HORIZONTAL
|
|
@@ -2576,6 +2649,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2576
2649
|
}
|
|
2577
2650
|
dispose() {
|
|
2578
2651
|
this.removeDropTarget();
|
|
2652
|
+
super.dispose();
|
|
2579
2653
|
}
|
|
2580
2654
|
toggleClasses(quadrant, width, height) {
|
|
2581
2655
|
var _a, _b, _c, _d;
|
|
@@ -2753,8 +2827,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2753
2827
|
if (this.panel.view) {
|
|
2754
2828
|
const _onDidFocus = this.panel.view.content.onDidFocus;
|
|
2755
2829
|
const _onDidBlur = this.panel.view.content.onDidBlur;
|
|
2756
|
-
const
|
|
2757
|
-
disposable.addDisposables(onDidFocus(() => this._onDidFocus.fire()), onDidBlur(() => this._onDidBlur.fire()));
|
|
2830
|
+
const focusTracker = trackFocus(this._element);
|
|
2831
|
+
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
|
|
2758
2832
|
if (_onDidFocus) {
|
|
2759
2833
|
disposable.addDisposables(_onDidFocus(() => this._onDidFocus.fire()));
|
|
2760
2834
|
}
|
|
@@ -2797,6 +2871,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2797
2871
|
this._onDragStart = new Emitter();
|
|
2798
2872
|
this.onDragStart = this._onDragStart.event;
|
|
2799
2873
|
this.iframes = [];
|
|
2874
|
+
this.addDisposables(this._onDragStart);
|
|
2800
2875
|
this.configure();
|
|
2801
2876
|
}
|
|
2802
2877
|
configure() {
|
|
@@ -2847,13 +2922,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2847
2922
|
this.onChanged = this._onChanged.event;
|
|
2848
2923
|
this._onDropped = new Emitter();
|
|
2849
2924
|
this.onDrop = this._onDropped.event;
|
|
2850
|
-
this.addDisposables(this._onChanged, this._onDropped);
|
|
2851
2925
|
this._element = document.createElement('div');
|
|
2852
2926
|
this._element.className = 'tab';
|
|
2853
2927
|
this._element.tabIndex = 0;
|
|
2854
2928
|
this._element.draggable = true;
|
|
2855
2929
|
toggleClass(this.element, 'inactive-tab', true);
|
|
2856
|
-
this.addDisposables(new (class Handler extends DragHandler {
|
|
2930
|
+
this.addDisposables(this._onChanged, this._onDropped, new (class Handler extends DragHandler {
|
|
2857
2931
|
constructor() {
|
|
2858
2932
|
super(...arguments);
|
|
2859
2933
|
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
@@ -2866,9 +2940,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2866
2940
|
},
|
|
2867
2941
|
};
|
|
2868
2942
|
}
|
|
2869
|
-
dispose() {
|
|
2870
|
-
//
|
|
2871
|
-
}
|
|
2872
2943
|
})(this._element));
|
|
2873
2944
|
this.addDisposables(addDisposableListener(this._element, 'mousedown', (event) => {
|
|
2874
2945
|
if (event.defaultPrevented) {
|
|
@@ -2903,7 +2974,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2903
2974
|
});
|
|
2904
2975
|
this.addDisposables(this.droptarget.onDrop((event) => {
|
|
2905
2976
|
this._onDropped.fire(event);
|
|
2906
|
-
}));
|
|
2977
|
+
}), this.droptarget);
|
|
2907
2978
|
}
|
|
2908
2979
|
setActive(isActive) {
|
|
2909
2980
|
toggleClass(this.element, 'active-tab', isActive);
|
|
@@ -2918,7 +2989,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2918
2989
|
}
|
|
2919
2990
|
dispose() {
|
|
2920
2991
|
super.dispose();
|
|
2921
|
-
this.droptarget.dispose();
|
|
2922
2992
|
}
|
|
2923
2993
|
}
|
|
2924
2994
|
|
|
@@ -2964,9 +3034,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2964
3034
|
},
|
|
2965
3035
|
};
|
|
2966
3036
|
}
|
|
2967
|
-
dispose() {
|
|
2968
|
-
//
|
|
2969
|
-
}
|
|
2970
3037
|
}
|
|
2971
3038
|
|
|
2972
3039
|
class VoidContainer extends CompositeDisposable {
|
|
@@ -3122,6 +3189,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3122
3189
|
const tabToRemove = this.tabs.splice(index, 1)[0];
|
|
3123
3190
|
const { value, disposable } = tabToRemove;
|
|
3124
3191
|
disposable.dispose();
|
|
3192
|
+
value.dispose();
|
|
3125
3193
|
value.element.remove();
|
|
3126
3194
|
}
|
|
3127
3195
|
setActivePanel(panel) {
|
|
@@ -3165,9 +3233,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3165
3233
|
}
|
|
3166
3234
|
dispose() {
|
|
3167
3235
|
super.dispose();
|
|
3168
|
-
this.tabs
|
|
3169
|
-
|
|
3170
|
-
|
|
3236
|
+
for (const { value, disposable } of this.tabs) {
|
|
3237
|
+
disposable.dispose();
|
|
3238
|
+
value.dispose();
|
|
3239
|
+
}
|
|
3171
3240
|
this.tabs = [];
|
|
3172
3241
|
}
|
|
3173
3242
|
}
|
|
@@ -3265,7 +3334,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3265
3334
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
3266
3335
|
this.header.hidden = !!options.hideHeader;
|
|
3267
3336
|
this.locked = !!options.locked;
|
|
3268
|
-
this.addDisposables(this.
|
|
3337
|
+
this.addDisposables(this.tabsContainer.onDrop((event) => {
|
|
3269
3338
|
this.handleDropEvent(event.event, 'center', event.index);
|
|
3270
3339
|
}), this.contentContainer.onDidFocus(() => {
|
|
3271
3340
|
this.accessor.doSetGroupActive(this.groupPanel, true);
|
|
@@ -3273,7 +3342,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3273
3342
|
// noop
|
|
3274
3343
|
}), this.dropTarget.onDrop((event) => {
|
|
3275
3344
|
this.handleDropEvent(event.nativeEvent, event.position);
|
|
3276
|
-
}));
|
|
3345
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
3277
3346
|
}
|
|
3278
3347
|
initialize() {
|
|
3279
3348
|
var _a, _b;
|
|
@@ -3707,8 +3776,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3707
3776
|
this.layout(0, 0, true); // set some elements height/widths
|
|
3708
3777
|
this.addDisposables(this.gridview.onDidChange(() => {
|
|
3709
3778
|
this._bufferOnDidLayoutChange.fire();
|
|
3710
|
-
}))
|
|
3711
|
-
this.addDisposables(exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3779
|
+
}), exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3712
3780
|
this._bufferOnDidLayoutChange.fire();
|
|
3713
3781
|
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
3714
3782
|
this._onDidLayoutChange.fire();
|
|
@@ -3811,7 +3879,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3811
3879
|
this.gridview.layout(width, height);
|
|
3812
3880
|
}
|
|
3813
3881
|
dispose() {
|
|
3814
|
-
super.dispose();
|
|
3815
3882
|
this._onDidActiveGroupChange.dispose();
|
|
3816
3883
|
this._onDidAddGroup.dispose();
|
|
3817
3884
|
this._onDidRemoveGroup.dispose();
|
|
@@ -3820,6 +3887,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3820
3887
|
group.dispose();
|
|
3821
3888
|
}
|
|
3822
3889
|
this.gridview.dispose();
|
|
3890
|
+
super.dispose();
|
|
3823
3891
|
}
|
|
3824
3892
|
}
|
|
3825
3893
|
|
|
@@ -3883,7 +3951,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3883
3951
|
//
|
|
3884
3952
|
this._onUpdateParameters = new Emitter();
|
|
3885
3953
|
this.onUpdateParameters = this._onUpdateParameters.event;
|
|
3886
|
-
this.addDisposables(this.
|
|
3954
|
+
this.addDisposables(this.onDidFocusChange((event) => {
|
|
3887
3955
|
this._isFocused = event.isFocused;
|
|
3888
3956
|
}), this.onDidActiveChange((event) => {
|
|
3889
3957
|
this._isActive = event.isActive;
|
|
@@ -3892,14 +3960,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3892
3960
|
}), this.onDidDimensionsChange((event) => {
|
|
3893
3961
|
this._width = event.width;
|
|
3894
3962
|
this._height = event.height;
|
|
3895
|
-
}));
|
|
3963
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onFocusEvent, this._onActiveChange, this._onVisibilityChange, this._onUpdateParameters);
|
|
3896
3964
|
}
|
|
3897
3965
|
initialize(panel) {
|
|
3898
3966
|
this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
|
|
3899
3967
|
panel.update({
|
|
3900
|
-
params:
|
|
3901
|
-
params: parameters,
|
|
3902
|
-
},
|
|
3968
|
+
params: parameters,
|
|
3903
3969
|
});
|
|
3904
3970
|
});
|
|
3905
3971
|
}
|
|
@@ -3994,12 +4060,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3994
4060
|
this._element.style.height = '100%';
|
|
3995
4061
|
this._element.style.width = '100%';
|
|
3996
4062
|
this._element.style.overflow = 'hidden';
|
|
3997
|
-
const
|
|
3998
|
-
this.addDisposables(this.api, onDidFocus(() => {
|
|
4063
|
+
const focusTracker = trackFocus(this._element);
|
|
4064
|
+
this.addDisposables(this.api, focusTracker.onDidFocus(() => {
|
|
3999
4065
|
this.api._onDidChangeFocus.fire({ isFocused: true });
|
|
4000
|
-
}), onDidBlur(() => {
|
|
4066
|
+
}), focusTracker.onDidBlur(() => {
|
|
4001
4067
|
this.api._onDidChangeFocus.fire({ isFocused: false });
|
|
4002
|
-
}));
|
|
4068
|
+
}), focusTracker);
|
|
4003
4069
|
}
|
|
4004
4070
|
focus() {
|
|
4005
4071
|
this.api._onFocusEvent.fire();
|
|
@@ -4020,7 +4086,18 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4020
4086
|
}
|
|
4021
4087
|
update(event) {
|
|
4022
4088
|
var _a, _b;
|
|
4089
|
+
// merge the new parameters with the existing parameters
|
|
4023
4090
|
this._params = Object.assign(Object.assign({}, this._params), { params: Object.assign(Object.assign({}, (_a = this._params) === null || _a === void 0 ? void 0 : _a.params), event.params) });
|
|
4091
|
+
/**
|
|
4092
|
+
* delete new keys that have a value of undefined,
|
|
4093
|
+
* allow values of null
|
|
4094
|
+
*/
|
|
4095
|
+
for (const key of Object.keys(event.params)) {
|
|
4096
|
+
if (event.params[key] === undefined) {
|
|
4097
|
+
delete this._params.params[key];
|
|
4098
|
+
}
|
|
4099
|
+
}
|
|
4100
|
+
// update the view with the updated props
|
|
4024
4101
|
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
|
|
4025
4102
|
}
|
|
4026
4103
|
toJSON() {
|
|
@@ -4034,9 +4111,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4034
4111
|
}
|
|
4035
4112
|
dispose() {
|
|
4036
4113
|
var _a;
|
|
4037
|
-
super.dispose();
|
|
4038
4114
|
this.api.dispose();
|
|
4039
4115
|
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
4116
|
+
super.dispose();
|
|
4040
4117
|
}
|
|
4041
4118
|
}
|
|
4042
4119
|
|
|
@@ -4415,7 +4492,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4415
4492
|
this._maximumHeight = options.maximumHeight;
|
|
4416
4493
|
}
|
|
4417
4494
|
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
|
|
4418
|
-
this.addDisposables(this.
|
|
4495
|
+
this.addDisposables(this.api.onVisibilityChange((event) => {
|
|
4419
4496
|
const { isVisible } = event;
|
|
4420
4497
|
const { accessor } = this._params;
|
|
4421
4498
|
accessor.setVisible(this, isVisible);
|
|
@@ -4444,7 +4521,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4444
4521
|
height: event.height,
|
|
4445
4522
|
width: event.width,
|
|
4446
4523
|
});
|
|
4447
|
-
}));
|
|
4524
|
+
}), this._onDidChange);
|
|
4448
4525
|
}
|
|
4449
4526
|
setVisible(isVisible) {
|
|
4450
4527
|
this.api._onDidVisibilityChange.fire({ isVisible });
|
|
@@ -4601,7 +4678,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4601
4678
|
this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
|
|
4602
4679
|
}
|
|
4603
4680
|
setTitle(title) {
|
|
4604
|
-
this.panel.
|
|
4681
|
+
this.panel.setTitle(title);
|
|
4605
4682
|
}
|
|
4606
4683
|
close() {
|
|
4607
4684
|
this.group.model.closePanel(this.panel);
|
|
@@ -4623,7 +4700,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4623
4700
|
this.id = id;
|
|
4624
4701
|
this.containerApi = containerApi;
|
|
4625
4702
|
this.view = view;
|
|
4626
|
-
this._title = '';
|
|
4627
4703
|
this._group = group;
|
|
4628
4704
|
this.api = new DockviewPanelApiImpl(this, this._group);
|
|
4629
4705
|
this.addDisposables(this.api.onActiveChange(() => {
|
|
@@ -4636,8 +4712,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4636
4712
|
}
|
|
4637
4713
|
init(params) {
|
|
4638
4714
|
this._params = params.params;
|
|
4639
|
-
this.setTitle(params.title);
|
|
4640
4715
|
this.view.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));
|
|
4716
|
+
this.setTitle(params.title);
|
|
4641
4717
|
}
|
|
4642
4718
|
focus() {
|
|
4643
4719
|
this.api._onFocusEvent.fire();
|
|
@@ -4654,11 +4730,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4654
4730
|
};
|
|
4655
4731
|
}
|
|
4656
4732
|
setTitle(title) {
|
|
4657
|
-
|
|
4658
|
-
const didTitleChange = title !== ((_a = this._params) === null || _a === void 0 ? void 0 : _a.title);
|
|
4733
|
+
const didTitleChange = title !== this.title;
|
|
4659
4734
|
if (didTitleChange) {
|
|
4660
4735
|
this._title = title;
|
|
4661
|
-
|
|
4736
|
+
this.view.update({
|
|
4662
4737
|
params: {
|
|
4663
4738
|
params: this._params,
|
|
4664
4739
|
title: this.title,
|
|
@@ -4668,14 +4743,19 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4668
4743
|
}
|
|
4669
4744
|
}
|
|
4670
4745
|
update(event) {
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4746
|
+
// merge the new parameters with the existing parameters
|
|
4747
|
+
this._params = Object.assign(Object.assign({}, (this._params || {})), event.params);
|
|
4748
|
+
/**
|
|
4749
|
+
* delete new keys that have a value of undefined,
|
|
4750
|
+
* allow values of null
|
|
4751
|
+
*/
|
|
4752
|
+
for (const key of Object.keys(event.params)) {
|
|
4753
|
+
if (event.params[key] === undefined) {
|
|
4754
|
+
delete this._params[key];
|
|
4755
|
+
}
|
|
4677
4756
|
}
|
|
4678
|
-
|
|
4757
|
+
// update the view with the updated props
|
|
4758
|
+
this.view.update({
|
|
4679
4759
|
params: {
|
|
4680
4760
|
params: this._params,
|
|
4681
4761
|
title: this.title,
|
|
@@ -5050,7 +5130,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5050
5130
|
size: { type: 'pixels', value: 20 },
|
|
5051
5131
|
},
|
|
5052
5132
|
});
|
|
5053
|
-
this.addDisposables(dropTarget
|
|
5133
|
+
this.addDisposables(dropTarget.onDrop((event) => {
|
|
5054
5134
|
const data = getPanelData();
|
|
5055
5135
|
if (data) {
|
|
5056
5136
|
this.moveGroupOrPanel(this.orthogonalize(event.position), data.groupId, data.panelId || undefined, 'center');
|
|
@@ -5058,7 +5138,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5058
5138
|
else {
|
|
5059
5139
|
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: null, getData: getPanelData }));
|
|
5060
5140
|
}
|
|
5061
|
-
}));
|
|
5141
|
+
}), dropTarget);
|
|
5062
5142
|
this._api = new DockviewApi(this);
|
|
5063
5143
|
this.updateWatermark();
|
|
5064
5144
|
}
|
|
@@ -5382,31 +5462,33 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5382
5462
|
}
|
|
5383
5463
|
super.doRemoveGroup(group, { skipActive });
|
|
5384
5464
|
}
|
|
5385
|
-
moveGroupOrPanel(
|
|
5465
|
+
moveGroupOrPanel(destinationGroup, sourceGroupId, sourceItemId, destinationTarget, destinationIndex) {
|
|
5386
5466
|
var _a;
|
|
5387
|
-
const sourceGroup =
|
|
5388
|
-
? (_a = this._groups.get(
|
|
5467
|
+
const sourceGroup = sourceGroupId
|
|
5468
|
+
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
5389
5469
|
: undefined;
|
|
5390
|
-
if (
|
|
5470
|
+
if (sourceItemId === undefined) {
|
|
5391
5471
|
if (sourceGroup) {
|
|
5392
|
-
this.moveGroup(sourceGroup,
|
|
5472
|
+
this.moveGroup(sourceGroup, destinationGroup, destinationTarget);
|
|
5393
5473
|
}
|
|
5394
5474
|
return;
|
|
5395
5475
|
}
|
|
5396
|
-
if (!
|
|
5397
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(
|
|
5398
|
-
this.panels.find((panel) => panel.id ===
|
|
5476
|
+
if (!destinationTarget || destinationTarget === 'center') {
|
|
5477
|
+
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(sourceItemId)) ||
|
|
5478
|
+
this.panels.find((panel) => panel.id === sourceItemId);
|
|
5399
5479
|
if (!groupItem) {
|
|
5400
|
-
throw new Error(`No panel with id ${
|
|
5480
|
+
throw new Error(`No panel with id ${sourceItemId}`);
|
|
5401
5481
|
}
|
|
5402
5482
|
if ((sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.size) === 0) {
|
|
5403
5483
|
this.doRemoveGroup(sourceGroup);
|
|
5404
5484
|
}
|
|
5405
|
-
|
|
5485
|
+
destinationGroup.model.openPanel(groupItem, {
|
|
5486
|
+
index: destinationIndex,
|
|
5487
|
+
});
|
|
5406
5488
|
}
|
|
5407
5489
|
else {
|
|
5408
|
-
const referenceLocation = getGridLocation(
|
|
5409
|
-
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation,
|
|
5490
|
+
const referenceLocation = getGridLocation(destinationGroup.element);
|
|
5491
|
+
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5410
5492
|
if (sourceGroup && sourceGroup.size < 2) {
|
|
5411
5493
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
5412
5494
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
@@ -5424,18 +5506,18 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5424
5506
|
skipDispose: true,
|
|
5425
5507
|
});
|
|
5426
5508
|
// after deleting the group we need to re-evaulate the ref location
|
|
5427
|
-
const updatedReferenceLocation = getGridLocation(
|
|
5428
|
-
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation,
|
|
5509
|
+
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
5510
|
+
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
5429
5511
|
this.doAddGroup(targetGroup, location);
|
|
5430
5512
|
}
|
|
5431
5513
|
}
|
|
5432
5514
|
else {
|
|
5433
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(
|
|
5434
|
-
this.panels.find((panel) => panel.id ===
|
|
5515
|
+
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(sourceItemId)) ||
|
|
5516
|
+
this.panels.find((panel) => panel.id === sourceItemId);
|
|
5435
5517
|
if (!groupItem) {
|
|
5436
|
-
throw new Error(`No panel with id ${
|
|
5518
|
+
throw new Error(`No panel with id ${sourceItemId}`);
|
|
5437
5519
|
}
|
|
5438
|
-
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation,
|
|
5520
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5439
5521
|
const group = this.createGroupAtLocation(dropLocation);
|
|
5440
5522
|
group.model.openPanel(groupItem);
|
|
5441
5523
|
}
|
|
@@ -5529,11 +5611,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5529
5611
|
return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
|
|
5530
5612
|
}
|
|
5531
5613
|
dispose() {
|
|
5532
|
-
super.dispose();
|
|
5533
5614
|
this._onDidActivePanelChange.dispose();
|
|
5534
5615
|
this._onDidAddPanel.dispose();
|
|
5535
5616
|
this._onDidRemovePanel.dispose();
|
|
5536
5617
|
this._onDidLayoutFromJSON.dispose();
|
|
5618
|
+
super.dispose();
|
|
5537
5619
|
}
|
|
5538
5620
|
}
|
|
5539
5621
|
|
|
@@ -5791,7 +5873,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5791
5873
|
}
|
|
5792
5874
|
set splitview(value) {
|
|
5793
5875
|
this._splitview = value;
|
|
5794
|
-
this.
|
|
5876
|
+
this._splitviewChangeDisposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
|
|
5795
5877
|
this._onDidLayoutChange.fire(undefined);
|
|
5796
5878
|
}), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
|
|
5797
5879
|
}
|
|
@@ -5813,7 +5895,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5813
5895
|
}
|
|
5814
5896
|
constructor(options) {
|
|
5815
5897
|
super(options.parentElement);
|
|
5816
|
-
this.
|
|
5898
|
+
this._splitviewChangeDisposable = new MutableDisposable();
|
|
5817
5899
|
this._panels = new Map();
|
|
5818
5900
|
this._onDidLayoutfromJSON = new Emitter();
|
|
5819
5901
|
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
@@ -5831,7 +5913,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5831
5913
|
options.frameworkComponents = {};
|
|
5832
5914
|
}
|
|
5833
5915
|
this.splitview = new Splitview(this.element, options);
|
|
5834
|
-
this.addDisposables(this.
|
|
5916
|
+
this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
|
|
5835
5917
|
}
|
|
5836
5918
|
updateOptions(options) {
|
|
5837
5919
|
const hasOrientationChanged = typeof options.orientation === 'string' &&
|
|
@@ -5869,15 +5951,15 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5869
5951
|
}
|
|
5870
5952
|
}
|
|
5871
5953
|
removePanel(panel, sizing) {
|
|
5872
|
-
const
|
|
5873
|
-
if (!
|
|
5954
|
+
const item = this._panels.get(panel.id);
|
|
5955
|
+
if (!item) {
|
|
5874
5956
|
throw new Error(`unknown splitview panel ${panel.id}`);
|
|
5875
5957
|
}
|
|
5876
|
-
|
|
5877
|
-
disposable.value.dispose();
|
|
5958
|
+
item.dispose();
|
|
5878
5959
|
this._panels.delete(panel.id);
|
|
5879
5960
|
const index = this.panels.findIndex((_) => _ === panel);
|
|
5880
|
-
this.splitview.removeView(index, sizing);
|
|
5961
|
+
const removedView = this.splitview.removeView(index, sizing);
|
|
5962
|
+
removedView.dispose();
|
|
5881
5963
|
const panels = this.panels;
|
|
5882
5964
|
if (panels.length > 0) {
|
|
5883
5965
|
this.setActive(panels[panels.length - 1]);
|
|
@@ -5924,7 +6006,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5924
6006
|
}
|
|
5925
6007
|
this.setActive(view, true);
|
|
5926
6008
|
});
|
|
5927
|
-
this._panels.set(view.id,
|
|
6009
|
+
this._panels.set(view.id, disposable);
|
|
5928
6010
|
}
|
|
5929
6011
|
toJSON() {
|
|
5930
6012
|
var _a;
|
|
@@ -5997,20 +6079,26 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5997
6079
|
this._onDidLayoutfromJSON.fire();
|
|
5998
6080
|
}
|
|
5999
6081
|
clear() {
|
|
6000
|
-
for (const
|
|
6001
|
-
|
|
6002
|
-
value.value.dispose();
|
|
6082
|
+
for (const disposable of this._panels.values()) {
|
|
6083
|
+
disposable.dispose();
|
|
6003
6084
|
}
|
|
6004
6085
|
this._panels.clear();
|
|
6005
|
-
this.splitview.
|
|
6086
|
+
while (this.splitview.length > 0) {
|
|
6087
|
+
const view = this.splitview.removeView(0, exports.Sizing.Distribute, true);
|
|
6088
|
+
view.dispose();
|
|
6089
|
+
}
|
|
6006
6090
|
}
|
|
6007
6091
|
dispose() {
|
|
6008
|
-
for (const
|
|
6009
|
-
|
|
6010
|
-
value.value.dispose();
|
|
6092
|
+
for (const disposable of this._panels.values()) {
|
|
6093
|
+
disposable.dispose();
|
|
6011
6094
|
}
|
|
6012
6095
|
this._panels.clear();
|
|
6096
|
+
const views = this.splitview.getViews();
|
|
6097
|
+
this._splitviewChangeDisposable.dispose();
|
|
6013
6098
|
this.splitview.dispose();
|
|
6099
|
+
for (const view of views) {
|
|
6100
|
+
view.dispose();
|
|
6101
|
+
}
|
|
6014
6102
|
super.dispose();
|
|
6015
6103
|
}
|
|
6016
6104
|
}
|