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
|
*/
|
|
@@ -91,9 +91,49 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
93
|
})(exports.DockviewEvent || (exports.DockviewEvent = {}));
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
class LeakageMonitor {
|
|
95
|
+
constructor() {
|
|
96
|
+
this.events = new Map();
|
|
97
|
+
}
|
|
98
|
+
get size() {
|
|
99
|
+
return this.events.size;
|
|
100
|
+
}
|
|
101
|
+
add(event, stacktrace) {
|
|
102
|
+
this.events.set(event, stacktrace);
|
|
103
|
+
}
|
|
104
|
+
delete(event) {
|
|
105
|
+
this.events.delete(event);
|
|
106
|
+
}
|
|
107
|
+
clear() {
|
|
108
|
+
this.events.clear();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
class Stacktrace {
|
|
112
|
+
static create() {
|
|
113
|
+
var _a;
|
|
114
|
+
return new Stacktrace((_a = new Error().stack) !== null && _a !== void 0 ? _a : '');
|
|
115
|
+
}
|
|
116
|
+
constructor(value) {
|
|
117
|
+
this.value = value;
|
|
118
|
+
}
|
|
119
|
+
print() {
|
|
120
|
+
console.warn(this.value);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
class Listener {
|
|
124
|
+
constructor(callback, stacktrace) {
|
|
125
|
+
this.callback = callback;
|
|
126
|
+
this.stacktrace = stacktrace;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// relatively simple event emitter taken from https://github.com/microsoft/vscode/blob/master/src/vs/base/common/event.ts
|
|
96
130
|
class Emitter {
|
|
131
|
+
static setLeakageMonitorEnabled(isEnabled) {
|
|
132
|
+
if (isEnabled !== Emitter.ENABLE_TRACKING) {
|
|
133
|
+
Emitter.MEMORY_LEAK_WATCHER.clear();
|
|
134
|
+
}
|
|
135
|
+
Emitter.ENABLE_TRACKING = isEnabled;
|
|
136
|
+
}
|
|
97
137
|
constructor(options) {
|
|
98
138
|
this.options = options;
|
|
99
139
|
this._listeners = [];
|
|
@@ -101,11 +141,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
101
141
|
}
|
|
102
142
|
get event() {
|
|
103
143
|
if (!this._event) {
|
|
104
|
-
this._event = (
|
|
144
|
+
this._event = (callback) => {
|
|
105
145
|
var _a;
|
|
106
146
|
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) && this._last !== undefined) {
|
|
107
|
-
|
|
147
|
+
callback(this._last);
|
|
108
148
|
}
|
|
149
|
+
const listener = new Listener(callback, Emitter.ENABLE_TRACKING ? Stacktrace.create() : undefined);
|
|
109
150
|
this._listeners.push(listener);
|
|
110
151
|
return {
|
|
111
152
|
dispose: () => {
|
|
@@ -113,23 +154,45 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
113
154
|
if (index > -1) {
|
|
114
155
|
this._listeners.splice(index, 1);
|
|
115
156
|
}
|
|
157
|
+
else if (Emitter.ENABLE_TRACKING) ;
|
|
116
158
|
},
|
|
117
159
|
};
|
|
118
160
|
};
|
|
161
|
+
if (Emitter.ENABLE_TRACKING) {
|
|
162
|
+
Emitter.MEMORY_LEAK_WATCHER.add(this._event, Stacktrace.create());
|
|
163
|
+
}
|
|
119
164
|
}
|
|
120
165
|
return this._event;
|
|
121
166
|
}
|
|
122
167
|
fire(e) {
|
|
123
168
|
this._last = e;
|
|
124
169
|
for (const listener of this._listeners) {
|
|
125
|
-
listener(e);
|
|
170
|
+
listener.callback(e);
|
|
126
171
|
}
|
|
127
172
|
}
|
|
128
173
|
dispose() {
|
|
129
|
-
this.
|
|
130
|
-
|
|
174
|
+
if (!this._disposed) {
|
|
175
|
+
this._disposed = true;
|
|
176
|
+
if (this._listeners.length > 0) {
|
|
177
|
+
if (Emitter.ENABLE_TRACKING) {
|
|
178
|
+
queueMicrotask(() => {
|
|
179
|
+
var _a;
|
|
180
|
+
// don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block
|
|
181
|
+
for (const listener of this._listeners) {
|
|
182
|
+
console.warn((_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
this._listeners = [];
|
|
187
|
+
}
|
|
188
|
+
if (Emitter.ENABLE_TRACKING && this._event) {
|
|
189
|
+
Emitter.MEMORY_LEAK_WATCHER.delete(this._event);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
131
192
|
}
|
|
132
193
|
}
|
|
194
|
+
Emitter.ENABLE_TRACKING = false;
|
|
195
|
+
Emitter.MEMORY_LEAK_WATCHER = new LeakageMonitor();
|
|
133
196
|
function addDisposableWindowListener(element, type, listener, options) {
|
|
134
197
|
element.addEventListener(type, listener, options);
|
|
135
198
|
return {
|
|
@@ -182,13 +245,13 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
182
245
|
}
|
|
183
246
|
constructor(...args) {
|
|
184
247
|
this._isDisposed = false;
|
|
185
|
-
this.
|
|
248
|
+
this._disposables = args;
|
|
186
249
|
}
|
|
187
250
|
addDisposables(...args) {
|
|
188
|
-
args.forEach((arg) => this.
|
|
251
|
+
args.forEach((arg) => this._disposables.push(arg));
|
|
189
252
|
}
|
|
190
253
|
dispose() {
|
|
191
|
-
this.
|
|
254
|
+
this._disposables.forEach((arg) => arg.dispose());
|
|
192
255
|
this._isDisposed = true;
|
|
193
256
|
}
|
|
194
257
|
}
|
|
@@ -278,6 +341,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
278
341
|
this.onDidFocus = this._onDidFocus.event;
|
|
279
342
|
this._onDidBlur = new Emitter();
|
|
280
343
|
this.onDidBlur = this._onDidBlur.event;
|
|
344
|
+
this.addDisposables(this._onDidFocus, this._onDidBlur);
|
|
281
345
|
let hasFocus = isAncestor(document.activeElement, element);
|
|
282
346
|
let loosingFocus = false;
|
|
283
347
|
const onFocus = () => {
|
|
@@ -322,11 +386,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
322
386
|
refreshState() {
|
|
323
387
|
this._refreshStateHandler();
|
|
324
388
|
}
|
|
325
|
-
dispose() {
|
|
326
|
-
super.dispose();
|
|
327
|
-
this._onDidBlur.dispose();
|
|
328
|
-
this._onDidFocus.dispose();
|
|
329
|
-
}
|
|
330
389
|
}
|
|
331
390
|
|
|
332
391
|
function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
|
|
@@ -555,7 +614,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
555
614
|
this._orthogonalSize = value;
|
|
556
615
|
}
|
|
557
616
|
get length() {
|
|
558
|
-
return this.
|
|
617
|
+
return this.viewItems.length;
|
|
559
618
|
}
|
|
560
619
|
get proportions() {
|
|
561
620
|
return this._proportions ? [...this._proportions] : undefined;
|
|
@@ -574,12 +633,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
574
633
|
: 'vertical');
|
|
575
634
|
}
|
|
576
635
|
get minimumSize() {
|
|
577
|
-
return this.
|
|
636
|
+
return this.viewItems.reduce((r, item) => r + item.minimumSize, 0);
|
|
578
637
|
}
|
|
579
638
|
get maximumSize() {
|
|
580
639
|
return this.length === 0
|
|
581
640
|
? Number.POSITIVE_INFINITY
|
|
582
|
-
: this.
|
|
641
|
+
: this.viewItems.reduce((r, item) => r + item.maximumSize, 0);
|
|
583
642
|
}
|
|
584
643
|
get startSnappingEnabled() {
|
|
585
644
|
return this._startSnappingEnabled;
|
|
@@ -603,7 +662,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
603
662
|
}
|
|
604
663
|
constructor(container, options) {
|
|
605
664
|
this.container = container;
|
|
606
|
-
this.
|
|
665
|
+
this.viewItems = [];
|
|
607
666
|
this.sashes = [];
|
|
608
667
|
this._size = 0;
|
|
609
668
|
this._orthogonalSize = 0;
|
|
@@ -617,12 +676,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
617
676
|
this.onDidAddView = this._onDidAddView.event;
|
|
618
677
|
this._onDidRemoveView = new Emitter();
|
|
619
678
|
this.onDidRemoveView = this._onDidRemoveView.event;
|
|
620
|
-
this.resize = (index, delta, sizes = this.
|
|
621
|
-
if (index < 0 || index > this.
|
|
679
|
+
this.resize = (index, delta, sizes = this.viewItems.map((x) => x.size), lowPriorityIndexes, highPriorityIndexes, overloadMinDelta = Number.NEGATIVE_INFINITY, overloadMaxDelta = Number.POSITIVE_INFINITY, snapBefore, snapAfter) => {
|
|
680
|
+
if (index < 0 || index > this.viewItems.length) {
|
|
622
681
|
return 0;
|
|
623
682
|
}
|
|
624
683
|
const upIndexes = range(index, -1);
|
|
625
|
-
const downIndexes = range(index + 1, this.
|
|
684
|
+
const downIndexes = range(index + 1, this.viewItems.length);
|
|
626
685
|
//
|
|
627
686
|
if (highPriorityIndexes) {
|
|
628
687
|
for (const i of highPriorityIndexes) {
|
|
@@ -637,34 +696,34 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
637
696
|
}
|
|
638
697
|
}
|
|
639
698
|
//
|
|
640
|
-
const upItems = upIndexes.map((i) => this.
|
|
699
|
+
const upItems = upIndexes.map((i) => this.viewItems[i]);
|
|
641
700
|
const upSizes = upIndexes.map((i) => sizes[i]);
|
|
642
701
|
//
|
|
643
|
-
const downItems = downIndexes.map((i) => this.
|
|
702
|
+
const downItems = downIndexes.map((i) => this.viewItems[i]);
|
|
644
703
|
const downSizes = downIndexes.map((i) => sizes[i]);
|
|
645
704
|
//
|
|
646
|
-
const minDeltaUp = upIndexes.reduce((_, i) => _ + this.
|
|
647
|
-
const maxDeltaUp = upIndexes.reduce((_, i) => _ + this.
|
|
705
|
+
const minDeltaUp = upIndexes.reduce((_, i) => _ + this.viewItems[i].minimumSize - sizes[i], 0);
|
|
706
|
+
const maxDeltaUp = upIndexes.reduce((_, i) => _ + this.viewItems[i].maximumSize - sizes[i], 0);
|
|
648
707
|
//
|
|
649
708
|
const maxDeltaDown = downIndexes.length === 0
|
|
650
709
|
? Number.POSITIVE_INFINITY
|
|
651
|
-
: downIndexes.reduce((_, i) => _ + sizes[i] - this.
|
|
710
|
+
: downIndexes.reduce((_, i) => _ + sizes[i] - this.viewItems[i].minimumSize, 0);
|
|
652
711
|
const minDeltaDown = downIndexes.length === 0
|
|
653
712
|
? Number.NEGATIVE_INFINITY
|
|
654
|
-
: downIndexes.reduce((_, i) => _ + sizes[i] - this.
|
|
713
|
+
: downIndexes.reduce((_, i) => _ + sizes[i] - this.viewItems[i].maximumSize, 0);
|
|
655
714
|
//
|
|
656
715
|
const minDelta = Math.max(minDeltaUp, minDeltaDown);
|
|
657
716
|
const maxDelta = Math.min(maxDeltaDown, maxDeltaUp);
|
|
658
717
|
//
|
|
659
718
|
let snapped = false;
|
|
660
719
|
if (snapBefore) {
|
|
661
|
-
const snapView = this.
|
|
720
|
+
const snapView = this.viewItems[snapBefore.index];
|
|
662
721
|
const visible = delta >= snapBefore.limitDelta;
|
|
663
722
|
snapped = visible !== snapView.visible;
|
|
664
723
|
snapView.setVisible(visible, snapBefore.size);
|
|
665
724
|
}
|
|
666
725
|
if (!snapped && snapAfter) {
|
|
667
|
-
const snapView = this.
|
|
726
|
+
const snapView = this.viewItems[snapAfter.index];
|
|
668
727
|
const visible = delta < snapAfter.limitDelta;
|
|
669
728
|
snapped = visible !== snapView.visible;
|
|
670
729
|
snapView.setVisible(visible, snapAfter.size);
|
|
@@ -726,7 +785,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
726
785
|
);
|
|
727
786
|
});
|
|
728
787
|
// Initialize content size and proportions for first layout
|
|
729
|
-
this.contentSize = this.
|
|
788
|
+
this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
730
789
|
this.saveProportions();
|
|
731
790
|
}
|
|
732
791
|
}
|
|
@@ -743,18 +802,18 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
743
802
|
}
|
|
744
803
|
}
|
|
745
804
|
isViewVisible(index) {
|
|
746
|
-
if (index < 0 || index >= this.
|
|
805
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
747
806
|
throw new Error('Index out of bounds');
|
|
748
807
|
}
|
|
749
|
-
const viewItem = this.
|
|
808
|
+
const viewItem = this.viewItems[index];
|
|
750
809
|
return viewItem.visible;
|
|
751
810
|
}
|
|
752
811
|
setViewVisible(index, visible) {
|
|
753
|
-
if (index < 0 || index >= this.
|
|
812
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
754
813
|
throw new Error('Index out of bounds');
|
|
755
814
|
}
|
|
756
815
|
toggleClass(this.container, 'visible', visible);
|
|
757
|
-
const viewItem = this.
|
|
816
|
+
const viewItem = this.viewItems[index];
|
|
758
817
|
toggleClass(this.container, 'visible', visible);
|
|
759
818
|
viewItem.setVisible(visible, viewItem.size);
|
|
760
819
|
this.distributeEmptySpace(index);
|
|
@@ -762,33 +821,33 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
762
821
|
this.saveProportions();
|
|
763
822
|
}
|
|
764
823
|
getViewSize(index) {
|
|
765
|
-
if (index < 0 || index >= this.
|
|
824
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
766
825
|
return -1;
|
|
767
826
|
}
|
|
768
|
-
return this.
|
|
827
|
+
return this.viewItems[index].size;
|
|
769
828
|
}
|
|
770
829
|
resizeView(index, size) {
|
|
771
|
-
if (index < 0 || index >= this.
|
|
830
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
772
831
|
return;
|
|
773
832
|
}
|
|
774
|
-
const indexes = range(this.
|
|
833
|
+
const indexes = range(this.viewItems.length).filter((i) => i !== index);
|
|
775
834
|
const lowPriorityIndexes = [
|
|
776
|
-
...indexes.filter((i) => this.
|
|
835
|
+
...indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low),
|
|
777
836
|
index,
|
|
778
837
|
];
|
|
779
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
780
|
-
const item = this.
|
|
838
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
839
|
+
const item = this.viewItems[index];
|
|
781
840
|
size = Math.round(size);
|
|
782
841
|
size = clamp(size, item.minimumSize, Math.min(item.maximumSize, this._size));
|
|
783
842
|
item.size = size;
|
|
784
843
|
this.relayout(lowPriorityIndexes, highPriorityIndexes);
|
|
785
844
|
}
|
|
786
845
|
getViews() {
|
|
787
|
-
return this.
|
|
846
|
+
return this.viewItems.map((x) => x.view);
|
|
788
847
|
}
|
|
789
848
|
onDidChange(item, size) {
|
|
790
|
-
const index = this.
|
|
791
|
-
if (index < 0 || index >= this.
|
|
849
|
+
const index = this.viewItems.indexOf(item);
|
|
850
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
792
851
|
return;
|
|
793
852
|
}
|
|
794
853
|
size = typeof size === 'number' ? size : item.size;
|
|
@@ -796,7 +855,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
796
855
|
item.size = size;
|
|
797
856
|
this.relayout([index]);
|
|
798
857
|
}
|
|
799
|
-
addView(view, size = { type: 'distribute' }, index = this.
|
|
858
|
+
addView(view, size = { type: 'distribute' }, index = this.viewItems.length, skipLayout) {
|
|
800
859
|
const container = document.createElement('div');
|
|
801
860
|
container.className = 'view';
|
|
802
861
|
container.appendChild(view.element);
|
|
@@ -814,24 +873,25 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
814
873
|
viewSize = view.minimumSize;
|
|
815
874
|
}
|
|
816
875
|
const disposable = view.onDidChange((newSize) => this.onDidChange(viewItem, newSize.size));
|
|
817
|
-
const
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
876
|
+
const viewItem = new ViewItem(container, view, viewSize, {
|
|
877
|
+
dispose: () => {
|
|
878
|
+
disposable.dispose();
|
|
879
|
+
this.viewContainer.removeChild(container);
|
|
880
|
+
},
|
|
881
|
+
});
|
|
882
|
+
if (index === this.viewItems.length) {
|
|
823
883
|
this.viewContainer.appendChild(container);
|
|
824
884
|
}
|
|
825
885
|
else {
|
|
826
886
|
this.viewContainer.insertBefore(container, this.viewContainer.children.item(index));
|
|
827
887
|
}
|
|
828
|
-
this.
|
|
829
|
-
if (this.
|
|
888
|
+
this.viewItems.splice(index, 0, viewItem);
|
|
889
|
+
if (this.viewItems.length > 1) {
|
|
830
890
|
//add sash
|
|
831
891
|
const sash = document.createElement('div');
|
|
832
892
|
sash.className = 'sash';
|
|
833
893
|
const onStart = (event) => {
|
|
834
|
-
for (const item of this.
|
|
894
|
+
for (const item of this.viewItems) {
|
|
835
895
|
item.enabled = false;
|
|
836
896
|
}
|
|
837
897
|
const iframes = [
|
|
@@ -846,27 +906,29 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
846
906
|
: event.clientY;
|
|
847
907
|
const sashIndex = firstIndex(this.sashes, (s) => s.container === sash);
|
|
848
908
|
//
|
|
849
|
-
const sizes = this.
|
|
909
|
+
const sizes = this.viewItems.map((x) => x.size);
|
|
850
910
|
//
|
|
851
911
|
let snapBefore;
|
|
852
912
|
let snapAfter;
|
|
853
913
|
const upIndexes = range(sashIndex, -1);
|
|
854
|
-
const downIndexes = range(sashIndex + 1, this.
|
|
855
|
-
const minDeltaUp = upIndexes.reduce((r, i) => r + (this.
|
|
856
|
-
const maxDeltaUp = upIndexes.reduce((r, i) => r + (this.
|
|
914
|
+
const downIndexes = range(sashIndex + 1, this.viewItems.length);
|
|
915
|
+
const minDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].minimumSize - sizes[i]), 0);
|
|
916
|
+
const maxDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].viewMaximumSize - sizes[i]), 0);
|
|
857
917
|
const maxDeltaDown = downIndexes.length === 0
|
|
858
918
|
? Number.POSITIVE_INFINITY
|
|
859
|
-
: downIndexes.reduce((r, i) => r +
|
|
919
|
+
: downIndexes.reduce((r, i) => r +
|
|
920
|
+
(sizes[i] - this.viewItems[i].minimumSize), 0);
|
|
860
921
|
const minDeltaDown = downIndexes.length === 0
|
|
861
922
|
? Number.NEGATIVE_INFINITY
|
|
862
923
|
: downIndexes.reduce((r, i) => r +
|
|
863
|
-
(sizes[i] -
|
|
924
|
+
(sizes[i] -
|
|
925
|
+
this.viewItems[i].viewMaximumSize), 0);
|
|
864
926
|
const minDelta = Math.max(minDeltaUp, minDeltaDown);
|
|
865
927
|
const maxDelta = Math.min(maxDeltaDown, maxDeltaUp);
|
|
866
928
|
const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);
|
|
867
929
|
const snapAfterIndex = this.findFirstSnapIndex(downIndexes);
|
|
868
930
|
if (typeof snapBeforeIndex === 'number') {
|
|
869
|
-
const snappedViewItem = this.
|
|
931
|
+
const snappedViewItem = this.viewItems[snapBeforeIndex];
|
|
870
932
|
const halfSize = Math.floor(snappedViewItem.viewMinimumSize / 2);
|
|
871
933
|
snapBefore = {
|
|
872
934
|
index: snapBeforeIndex,
|
|
@@ -877,7 +939,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
877
939
|
};
|
|
878
940
|
}
|
|
879
941
|
if (typeof snapAfterIndex === 'number') {
|
|
880
|
-
const snappedViewItem = this.
|
|
942
|
+
const snappedViewItem = this.viewItems[snapAfterIndex];
|
|
881
943
|
const halfSize = Math.floor(snappedViewItem.viewMinimumSize / 2);
|
|
882
944
|
snapAfter = {
|
|
883
945
|
index: snapAfterIndex,
|
|
@@ -898,7 +960,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
898
960
|
this.layoutViews();
|
|
899
961
|
};
|
|
900
962
|
const end = () => {
|
|
901
|
-
for (const item of this.
|
|
963
|
+
for (const item of this.viewItems) {
|
|
902
964
|
item.enabled = true;
|
|
903
965
|
}
|
|
904
966
|
for (const iframe of iframes) {
|
|
@@ -938,7 +1000,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
938
1000
|
distributeViewSizes() {
|
|
939
1001
|
const flexibleViewItems = [];
|
|
940
1002
|
let flexibleSize = 0;
|
|
941
|
-
for (const item of this.
|
|
1003
|
+
for (const item of this.viewItems) {
|
|
942
1004
|
if (item.maximumSize - item.minimumSize > 0) {
|
|
943
1005
|
flexibleViewItems.push(item);
|
|
944
1006
|
flexibleSize += item.size;
|
|
@@ -948,17 +1010,17 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
948
1010
|
for (const item of flexibleViewItems) {
|
|
949
1011
|
item.size = clamp(size, item.minimumSize, item.maximumSize);
|
|
950
1012
|
}
|
|
951
|
-
const indexes = range(this.
|
|
952
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
953
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1013
|
+
const indexes = range(this.viewItems.length);
|
|
1014
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1015
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
954
1016
|
this.relayout(lowPriorityIndexes, highPriorityIndexes);
|
|
955
1017
|
}
|
|
956
1018
|
removeView(index, sizing, skipLayout = false) {
|
|
957
1019
|
// Remove view
|
|
958
|
-
const viewItem = this.
|
|
1020
|
+
const viewItem = this.viewItems.splice(index, 1)[0];
|
|
959
1021
|
viewItem.dispose();
|
|
960
1022
|
// Remove sash
|
|
961
|
-
if (this.
|
|
1023
|
+
if (this.viewItems.length >= 1) {
|
|
962
1024
|
const sashIndex = Math.max(index - 1, 0);
|
|
963
1025
|
const sashItem = this.sashes.splice(sashIndex, 1)[0];
|
|
964
1026
|
sashItem.disposable();
|
|
@@ -973,10 +1035,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
973
1035
|
return viewItem.view;
|
|
974
1036
|
}
|
|
975
1037
|
getViewCachedVisibleSize(index) {
|
|
976
|
-
if (index < 0 || index >= this.
|
|
1038
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
977
1039
|
throw new Error('Index out of bounds');
|
|
978
1040
|
}
|
|
979
|
-
const viewItem = this.
|
|
1041
|
+
const viewItem = this.viewItems[index];
|
|
980
1042
|
return viewItem.cachedVisibleSize;
|
|
981
1043
|
}
|
|
982
1044
|
moveView(from, to) {
|
|
@@ -992,14 +1054,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
992
1054
|
this.size = size;
|
|
993
1055
|
this.orthogonalSize = orthogonalSize;
|
|
994
1056
|
if (!this.proportions) {
|
|
995
|
-
const indexes = range(this.
|
|
996
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
997
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
998
|
-
this.resize(this.
|
|
1057
|
+
const indexes = range(this.viewItems.length);
|
|
1058
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1059
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1060
|
+
this.resize(this.viewItems.length - 1, size - previousSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
999
1061
|
}
|
|
1000
1062
|
else {
|
|
1001
|
-
for (let i = 0; i < this.
|
|
1002
|
-
const item = this.
|
|
1063
|
+
for (let i = 0; i < this.viewItems.length; i++) {
|
|
1064
|
+
const item = this.viewItems[i];
|
|
1003
1065
|
item.size = clamp(Math.round(this.proportions[i] * size), item.minimumSize, item.maximumSize);
|
|
1004
1066
|
}
|
|
1005
1067
|
}
|
|
@@ -1007,18 +1069,18 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1007
1069
|
this.layoutViews();
|
|
1008
1070
|
}
|
|
1009
1071
|
relayout(lowPriorityIndexes, highPriorityIndexes) {
|
|
1010
|
-
const contentSize = this.
|
|
1011
|
-
this.resize(this.
|
|
1072
|
+
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1073
|
+
this.resize(this.viewItems.length - 1, this._size - contentSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
1012
1074
|
this.distributeEmptySpace();
|
|
1013
1075
|
this.layoutViews();
|
|
1014
1076
|
this.saveProportions();
|
|
1015
1077
|
}
|
|
1016
1078
|
distributeEmptySpace(lowPriorityIndex) {
|
|
1017
|
-
const contentSize = this.
|
|
1079
|
+
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1018
1080
|
let emptyDelta = this.size - contentSize;
|
|
1019
|
-
const indexes = range(this.
|
|
1020
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
1021
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1081
|
+
const indexes = range(this.viewItems.length - 1, -1);
|
|
1082
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1083
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1022
1084
|
for (const index of highPriorityIndexes) {
|
|
1023
1085
|
pushToStart(indexes, index);
|
|
1024
1086
|
}
|
|
@@ -1029,7 +1091,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1029
1091
|
pushToEnd(indexes, lowPriorityIndex);
|
|
1030
1092
|
}
|
|
1031
1093
|
for (let i = 0; emptyDelta !== 0 && i < indexes.length; i++) {
|
|
1032
|
-
const item = this.
|
|
1094
|
+
const item = this.viewItems[indexes[i]];
|
|
1033
1095
|
const size = clamp(item.size + emptyDelta, item.minimumSize, item.maximumSize);
|
|
1034
1096
|
const viewDelta = size - item.size;
|
|
1035
1097
|
emptyDelta -= viewDelta;
|
|
@@ -1038,16 +1100,16 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1038
1100
|
}
|
|
1039
1101
|
saveProportions() {
|
|
1040
1102
|
if (this.proportionalLayout && this.contentSize > 0) {
|
|
1041
|
-
this._proportions = this.
|
|
1103
|
+
this._proportions = this.viewItems.map((i) => i.size / this.contentSize);
|
|
1042
1104
|
}
|
|
1043
1105
|
}
|
|
1044
1106
|
layoutViews() {
|
|
1045
|
-
this.contentSize = this.
|
|
1107
|
+
this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1046
1108
|
let sum = 0;
|
|
1047
1109
|
const x = [];
|
|
1048
1110
|
this.updateSashEnablement();
|
|
1049
|
-
for (let i = 0; i < this.
|
|
1050
|
-
sum += this.
|
|
1111
|
+
for (let i = 0; i < this.viewItems.length - 1; i++) {
|
|
1112
|
+
sum += this.viewItems[i].size;
|
|
1051
1113
|
x.push(sum);
|
|
1052
1114
|
const offset = Math.min(Math.max(0, sum - 2), this.size - 4);
|
|
1053
1115
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
@@ -1059,7 +1121,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1059
1121
|
this.sashes[i].container.style.top = `${offset}px`;
|
|
1060
1122
|
}
|
|
1061
1123
|
}
|
|
1062
|
-
this.
|
|
1124
|
+
this.viewItems.forEach((view, i) => {
|
|
1063
1125
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
1064
1126
|
view.container.style.width = `${view.size}px`;
|
|
1065
1127
|
view.container.style.left = i == 0 ? '0px' : `${x[i - 1]}px`;
|
|
@@ -1078,7 +1140,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1078
1140
|
findFirstSnapIndex(indexes) {
|
|
1079
1141
|
// visible views first
|
|
1080
1142
|
for (const index of indexes) {
|
|
1081
|
-
const viewItem = this.
|
|
1143
|
+
const viewItem = this.viewItems[index];
|
|
1082
1144
|
if (!viewItem.visible) {
|
|
1083
1145
|
continue;
|
|
1084
1146
|
}
|
|
@@ -1088,7 +1150,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1088
1150
|
}
|
|
1089
1151
|
// then, hidden views
|
|
1090
1152
|
for (const index of indexes) {
|
|
1091
|
-
const viewItem = this.
|
|
1153
|
+
const viewItem = this.viewItems[index];
|
|
1092
1154
|
if (viewItem.visible &&
|
|
1093
1155
|
viewItem.maximumSize - viewItem.minimumSize > 0) {
|
|
1094
1156
|
return undefined;
|
|
@@ -1101,10 +1163,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1101
1163
|
}
|
|
1102
1164
|
updateSashEnablement() {
|
|
1103
1165
|
let previous = false;
|
|
1104
|
-
const collapsesDown = this.
|
|
1166
|
+
const collapsesDown = this.viewItems.map((i) => (previous = i.size - i.minimumSize > 0 || previous));
|
|
1105
1167
|
previous = false;
|
|
1106
|
-
const expandsDown = this.
|
|
1107
|
-
const reverseViews = [...this.
|
|
1168
|
+
const expandsDown = this.viewItems.map((i) => (previous = i.maximumSize - i.size > 0 || previous));
|
|
1169
|
+
const reverseViews = [...this.viewItems].reverse();
|
|
1108
1170
|
previous = false;
|
|
1109
1171
|
const collapsesUp = reverseViews
|
|
1110
1172
|
.map((i) => (previous = i.size - i.minimumSize > 0 || previous))
|
|
@@ -1116,19 +1178,19 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1116
1178
|
let position = 0;
|
|
1117
1179
|
for (let index = 0; index < this.sashes.length; index++) {
|
|
1118
1180
|
const sash = this.sashes[index];
|
|
1119
|
-
const viewItem = this.
|
|
1181
|
+
const viewItem = this.viewItems[index];
|
|
1120
1182
|
position += viewItem.size;
|
|
1121
1183
|
const min = !(collapsesDown[index] && expandsUp[index + 1]);
|
|
1122
1184
|
const max = !(expandsDown[index] && collapsesUp[index + 1]);
|
|
1123
1185
|
if (min && max) {
|
|
1124
1186
|
const upIndexes = range(index, -1);
|
|
1125
|
-
const downIndexes = range(index + 1, this.
|
|
1187
|
+
const downIndexes = range(index + 1, this.viewItems.length);
|
|
1126
1188
|
const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);
|
|
1127
1189
|
const snapAfterIndex = this.findFirstSnapIndex(downIndexes);
|
|
1128
1190
|
const snappedBefore = typeof snapBeforeIndex === 'number' &&
|
|
1129
|
-
!this.
|
|
1191
|
+
!this.viewItems[snapBeforeIndex].visible;
|
|
1130
1192
|
const snappedAfter = typeof snapAfterIndex === 'number' &&
|
|
1131
|
-
!this.
|
|
1193
|
+
!this.viewItems[snapAfterIndex].visible;
|
|
1132
1194
|
if (snappedBefore &&
|
|
1133
1195
|
collapsesUp[index] &&
|
|
1134
1196
|
(position > 0 || this.startSnappingEnabled)) {
|
|
@@ -1188,6 +1250,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1188
1250
|
break;
|
|
1189
1251
|
}
|
|
1190
1252
|
}
|
|
1253
|
+
for (const viewItem of this.viewItems) {
|
|
1254
|
+
viewItem.dispose();
|
|
1255
|
+
}
|
|
1191
1256
|
this.element.remove();
|
|
1192
1257
|
}
|
|
1193
1258
|
}
|
|
@@ -1622,7 +1687,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1622
1687
|
throw new Error('Invalid index');
|
|
1623
1688
|
}
|
|
1624
1689
|
this.splitview.removeView(index, sizing);
|
|
1625
|
-
this._removeChild(index);
|
|
1690
|
+
return this._removeChild(index);
|
|
1626
1691
|
}
|
|
1627
1692
|
_addChild(node, index) {
|
|
1628
1693
|
this.children.splice(index, 0, node);
|
|
@@ -1644,10 +1709,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1644
1709
|
});
|
|
1645
1710
|
}
|
|
1646
1711
|
dispose() {
|
|
1647
|
-
super.dispose();
|
|
1648
1712
|
this._childrenDisposable.dispose();
|
|
1649
|
-
this.children.forEach((child) => child.dispose());
|
|
1650
1713
|
this.splitview.dispose();
|
|
1714
|
+
this.children.forEach((child) => child.dispose());
|
|
1715
|
+
super.dispose();
|
|
1651
1716
|
}
|
|
1652
1717
|
}
|
|
1653
1718
|
|
|
@@ -1877,7 +1942,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1877
1942
|
if (oldRoot.children.length === 1) {
|
|
1878
1943
|
// can remove one level of redundant branching if there is only a single child
|
|
1879
1944
|
const childReference = oldRoot.children[0];
|
|
1880
|
-
oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
1945
|
+
const child = oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
1946
|
+
child.dispose();
|
|
1881
1947
|
oldRoot.dispose();
|
|
1882
1948
|
this._root.addChild(
|
|
1883
1949
|
/**
|
|
@@ -1984,7 +2050,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1984
2050
|
if (typeof newSiblingCachedVisibleSize === 'number') {
|
|
1985
2051
|
newSiblingSize = exports.Sizing.Invisible(newSiblingCachedVisibleSize);
|
|
1986
2052
|
}
|
|
1987
|
-
grandParent.removeChild(parentIndex);
|
|
2053
|
+
const child = grandParent.removeChild(parentIndex);
|
|
2054
|
+
child.dispose();
|
|
1988
2055
|
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize);
|
|
1989
2056
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
1990
2057
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
@@ -2010,30 +2077,36 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2010
2077
|
if (!(node instanceof LeafNode)) {
|
|
2011
2078
|
throw new Error('Invalid location');
|
|
2012
2079
|
}
|
|
2013
|
-
|
|
2080
|
+
const view = node.view;
|
|
2081
|
+
node.dispose(); // dispose of node
|
|
2082
|
+
const child = parent.removeChild(index, sizing);
|
|
2083
|
+
child.dispose();
|
|
2014
2084
|
if (parent.children.length === 0) {
|
|
2015
|
-
return
|
|
2085
|
+
return view;
|
|
2016
2086
|
}
|
|
2017
2087
|
if (parent.children.length > 1) {
|
|
2018
|
-
return
|
|
2088
|
+
return view;
|
|
2019
2089
|
}
|
|
2020
2090
|
const sibling = parent.children[0];
|
|
2021
2091
|
if (pathToParent.length === 0) {
|
|
2022
2092
|
// parent is root
|
|
2023
2093
|
if (sibling instanceof LeafNode) {
|
|
2024
|
-
return
|
|
2094
|
+
return view;
|
|
2025
2095
|
}
|
|
2026
2096
|
// we must promote sibling to be the new root
|
|
2027
|
-
parent.removeChild(0, sizing);
|
|
2097
|
+
const child = parent.removeChild(0, sizing);
|
|
2098
|
+
child.dispose();
|
|
2028
2099
|
this.root = sibling;
|
|
2029
|
-
return
|
|
2100
|
+
return view;
|
|
2030
2101
|
}
|
|
2031
2102
|
const [grandParent, ..._] = [...pathToParent].reverse();
|
|
2032
2103
|
const [parentIndex, ...__] = [...rest].reverse();
|
|
2033
2104
|
const isSiblingVisible = parent.isChildVisible(0);
|
|
2034
|
-
parent.removeChild(0, sizing);
|
|
2105
|
+
const childNode = parent.removeChild(0, sizing);
|
|
2106
|
+
childNode.dispose();
|
|
2035
2107
|
const sizes = grandParent.children.map((_size, i) => grandParent.getChildSize(i));
|
|
2036
|
-
grandParent.removeChild(parentIndex, sizing);
|
|
2108
|
+
const parentNode = grandParent.removeChild(parentIndex, sizing);
|
|
2109
|
+
parentNode.dispose();
|
|
2037
2110
|
if (sibling instanceof BranchNode) {
|
|
2038
2111
|
sizes.splice(parentIndex, 1, ...sibling.children.map((c) => c.size));
|
|
2039
2112
|
for (let i = 0; i < sibling.children.length; i++) {
|
|
@@ -2051,7 +2124,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2051
2124
|
for (let i = 0; i < sizes.length; i++) {
|
|
2052
2125
|
grandParent.resizeChild(i, sizes[i]);
|
|
2053
2126
|
}
|
|
2054
|
-
return
|
|
2127
|
+
return view;
|
|
2055
2128
|
}
|
|
2056
2129
|
layout(width, height) {
|
|
2057
2130
|
const [size, orthogonalSize] = this.root.orientation === exports.Orientation.HORIZONTAL
|
|
@@ -2546,6 +2619,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2546
2619
|
}
|
|
2547
2620
|
dispose() {
|
|
2548
2621
|
this.removeDropTarget();
|
|
2622
|
+
super.dispose();
|
|
2549
2623
|
}
|
|
2550
2624
|
toggleClasses(quadrant, width, height) {
|
|
2551
2625
|
var _a, _b, _c, _d;
|
|
@@ -2723,8 +2797,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2723
2797
|
if (this.panel.view) {
|
|
2724
2798
|
const _onDidFocus = this.panel.view.content.onDidFocus;
|
|
2725
2799
|
const _onDidBlur = this.panel.view.content.onDidBlur;
|
|
2726
|
-
const
|
|
2727
|
-
disposable.addDisposables(onDidFocus(() => this._onDidFocus.fire()), onDidBlur(() => this._onDidBlur.fire()));
|
|
2800
|
+
const focusTracker = trackFocus(this._element);
|
|
2801
|
+
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
|
|
2728
2802
|
if (_onDidFocus) {
|
|
2729
2803
|
disposable.addDisposables(_onDidFocus(() => this._onDidFocus.fire()));
|
|
2730
2804
|
}
|
|
@@ -2767,6 +2841,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2767
2841
|
this._onDragStart = new Emitter();
|
|
2768
2842
|
this.onDragStart = this._onDragStart.event;
|
|
2769
2843
|
this.iframes = [];
|
|
2844
|
+
this.addDisposables(this._onDragStart);
|
|
2770
2845
|
this.configure();
|
|
2771
2846
|
}
|
|
2772
2847
|
configure() {
|
|
@@ -2817,13 +2892,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2817
2892
|
this.onChanged = this._onChanged.event;
|
|
2818
2893
|
this._onDropped = new Emitter();
|
|
2819
2894
|
this.onDrop = this._onDropped.event;
|
|
2820
|
-
this.addDisposables(this._onChanged, this._onDropped);
|
|
2821
2895
|
this._element = document.createElement('div');
|
|
2822
2896
|
this._element.className = 'tab';
|
|
2823
2897
|
this._element.tabIndex = 0;
|
|
2824
2898
|
this._element.draggable = true;
|
|
2825
2899
|
toggleClass(this.element, 'inactive-tab', true);
|
|
2826
|
-
this.addDisposables(new (class Handler extends DragHandler {
|
|
2900
|
+
this.addDisposables(this._onChanged, this._onDropped, new (class Handler extends DragHandler {
|
|
2827
2901
|
constructor() {
|
|
2828
2902
|
super(...arguments);
|
|
2829
2903
|
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
@@ -2836,9 +2910,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2836
2910
|
},
|
|
2837
2911
|
};
|
|
2838
2912
|
}
|
|
2839
|
-
dispose() {
|
|
2840
|
-
//
|
|
2841
|
-
}
|
|
2842
2913
|
})(this._element));
|
|
2843
2914
|
this.addDisposables(addDisposableListener(this._element, 'mousedown', (event) => {
|
|
2844
2915
|
if (event.defaultPrevented) {
|
|
@@ -2873,7 +2944,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2873
2944
|
});
|
|
2874
2945
|
this.addDisposables(this.droptarget.onDrop((event) => {
|
|
2875
2946
|
this._onDropped.fire(event);
|
|
2876
|
-
}));
|
|
2947
|
+
}), this.droptarget);
|
|
2877
2948
|
}
|
|
2878
2949
|
setActive(isActive) {
|
|
2879
2950
|
toggleClass(this.element, 'active-tab', isActive);
|
|
@@ -2888,7 +2959,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2888
2959
|
}
|
|
2889
2960
|
dispose() {
|
|
2890
2961
|
super.dispose();
|
|
2891
|
-
this.droptarget.dispose();
|
|
2892
2962
|
}
|
|
2893
2963
|
}
|
|
2894
2964
|
|
|
@@ -2934,9 +3004,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2934
3004
|
},
|
|
2935
3005
|
};
|
|
2936
3006
|
}
|
|
2937
|
-
dispose() {
|
|
2938
|
-
//
|
|
2939
|
-
}
|
|
2940
3007
|
}
|
|
2941
3008
|
|
|
2942
3009
|
class VoidContainer extends CompositeDisposable {
|
|
@@ -3092,6 +3159,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3092
3159
|
const tabToRemove = this.tabs.splice(index, 1)[0];
|
|
3093
3160
|
const { value, disposable } = tabToRemove;
|
|
3094
3161
|
disposable.dispose();
|
|
3162
|
+
value.dispose();
|
|
3095
3163
|
value.element.remove();
|
|
3096
3164
|
}
|
|
3097
3165
|
setActivePanel(panel) {
|
|
@@ -3135,9 +3203,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3135
3203
|
}
|
|
3136
3204
|
dispose() {
|
|
3137
3205
|
super.dispose();
|
|
3138
|
-
this.tabs
|
|
3139
|
-
|
|
3140
|
-
|
|
3206
|
+
for (const { value, disposable } of this.tabs) {
|
|
3207
|
+
disposable.dispose();
|
|
3208
|
+
value.dispose();
|
|
3209
|
+
}
|
|
3141
3210
|
this.tabs = [];
|
|
3142
3211
|
}
|
|
3143
3212
|
}
|
|
@@ -3235,7 +3304,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3235
3304
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
3236
3305
|
this.header.hidden = !!options.hideHeader;
|
|
3237
3306
|
this.locked = !!options.locked;
|
|
3238
|
-
this.addDisposables(this.
|
|
3307
|
+
this.addDisposables(this.tabsContainer.onDrop((event) => {
|
|
3239
3308
|
this.handleDropEvent(event.event, 'center', event.index);
|
|
3240
3309
|
}), this.contentContainer.onDidFocus(() => {
|
|
3241
3310
|
this.accessor.doSetGroupActive(this.groupPanel, true);
|
|
@@ -3243,7 +3312,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3243
3312
|
// noop
|
|
3244
3313
|
}), this.dropTarget.onDrop((event) => {
|
|
3245
3314
|
this.handleDropEvent(event.nativeEvent, event.position);
|
|
3246
|
-
}));
|
|
3315
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
3247
3316
|
}
|
|
3248
3317
|
initialize() {
|
|
3249
3318
|
var _a, _b;
|
|
@@ -3677,8 +3746,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3677
3746
|
this.layout(0, 0, true); // set some elements height/widths
|
|
3678
3747
|
this.addDisposables(this.gridview.onDidChange(() => {
|
|
3679
3748
|
this._bufferOnDidLayoutChange.fire();
|
|
3680
|
-
}))
|
|
3681
|
-
this.addDisposables(exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3749
|
+
}), exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3682
3750
|
this._bufferOnDidLayoutChange.fire();
|
|
3683
3751
|
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
3684
3752
|
this._onDidLayoutChange.fire();
|
|
@@ -3781,7 +3849,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3781
3849
|
this.gridview.layout(width, height);
|
|
3782
3850
|
}
|
|
3783
3851
|
dispose() {
|
|
3784
|
-
super.dispose();
|
|
3785
3852
|
this._onDidActiveGroupChange.dispose();
|
|
3786
3853
|
this._onDidAddGroup.dispose();
|
|
3787
3854
|
this._onDidRemoveGroup.dispose();
|
|
@@ -3790,6 +3857,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3790
3857
|
group.dispose();
|
|
3791
3858
|
}
|
|
3792
3859
|
this.gridview.dispose();
|
|
3860
|
+
super.dispose();
|
|
3793
3861
|
}
|
|
3794
3862
|
}
|
|
3795
3863
|
|
|
@@ -3853,7 +3921,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3853
3921
|
//
|
|
3854
3922
|
this._onUpdateParameters = new Emitter();
|
|
3855
3923
|
this.onUpdateParameters = this._onUpdateParameters.event;
|
|
3856
|
-
this.addDisposables(this.
|
|
3924
|
+
this.addDisposables(this.onDidFocusChange((event) => {
|
|
3857
3925
|
this._isFocused = event.isFocused;
|
|
3858
3926
|
}), this.onDidActiveChange((event) => {
|
|
3859
3927
|
this._isActive = event.isActive;
|
|
@@ -3862,14 +3930,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3862
3930
|
}), this.onDidDimensionsChange((event) => {
|
|
3863
3931
|
this._width = event.width;
|
|
3864
3932
|
this._height = event.height;
|
|
3865
|
-
}));
|
|
3933
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onFocusEvent, this._onActiveChange, this._onVisibilityChange, this._onUpdateParameters);
|
|
3866
3934
|
}
|
|
3867
3935
|
initialize(panel) {
|
|
3868
3936
|
this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
|
|
3869
3937
|
panel.update({
|
|
3870
|
-
params:
|
|
3871
|
-
params: parameters,
|
|
3872
|
-
},
|
|
3938
|
+
params: parameters,
|
|
3873
3939
|
});
|
|
3874
3940
|
});
|
|
3875
3941
|
}
|
|
@@ -3964,12 +4030,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3964
4030
|
this._element.style.height = '100%';
|
|
3965
4031
|
this._element.style.width = '100%';
|
|
3966
4032
|
this._element.style.overflow = 'hidden';
|
|
3967
|
-
const
|
|
3968
|
-
this.addDisposables(this.api, onDidFocus(() => {
|
|
4033
|
+
const focusTracker = trackFocus(this._element);
|
|
4034
|
+
this.addDisposables(this.api, focusTracker.onDidFocus(() => {
|
|
3969
4035
|
this.api._onDidChangeFocus.fire({ isFocused: true });
|
|
3970
|
-
}), onDidBlur(() => {
|
|
4036
|
+
}), focusTracker.onDidBlur(() => {
|
|
3971
4037
|
this.api._onDidChangeFocus.fire({ isFocused: false });
|
|
3972
|
-
}));
|
|
4038
|
+
}), focusTracker);
|
|
3973
4039
|
}
|
|
3974
4040
|
focus() {
|
|
3975
4041
|
this.api._onFocusEvent.fire();
|
|
@@ -3990,7 +4056,18 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3990
4056
|
}
|
|
3991
4057
|
update(event) {
|
|
3992
4058
|
var _a, _b;
|
|
4059
|
+
// merge the new parameters with the existing parameters
|
|
3993
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
|
|
3994
4071
|
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
|
|
3995
4072
|
}
|
|
3996
4073
|
toJSON() {
|
|
@@ -4004,9 +4081,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4004
4081
|
}
|
|
4005
4082
|
dispose() {
|
|
4006
4083
|
var _a;
|
|
4007
|
-
super.dispose();
|
|
4008
4084
|
this.api.dispose();
|
|
4009
4085
|
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
4086
|
+
super.dispose();
|
|
4010
4087
|
}
|
|
4011
4088
|
}
|
|
4012
4089
|
|
|
@@ -4385,7 +4462,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4385
4462
|
this._maximumHeight = options.maximumHeight;
|
|
4386
4463
|
}
|
|
4387
4464
|
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
|
|
4388
|
-
this.addDisposables(this.
|
|
4465
|
+
this.addDisposables(this.api.onVisibilityChange((event) => {
|
|
4389
4466
|
const { isVisible } = event;
|
|
4390
4467
|
const { accessor } = this._params;
|
|
4391
4468
|
accessor.setVisible(this, isVisible);
|
|
@@ -4414,7 +4491,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4414
4491
|
height: event.height,
|
|
4415
4492
|
width: event.width,
|
|
4416
4493
|
});
|
|
4417
|
-
}));
|
|
4494
|
+
}), this._onDidChange);
|
|
4418
4495
|
}
|
|
4419
4496
|
setVisible(isVisible) {
|
|
4420
4497
|
this.api._onDidVisibilityChange.fire({ isVisible });
|
|
@@ -4571,7 +4648,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4571
4648
|
this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
|
|
4572
4649
|
}
|
|
4573
4650
|
setTitle(title) {
|
|
4574
|
-
this.panel.
|
|
4651
|
+
this.panel.setTitle(title);
|
|
4575
4652
|
}
|
|
4576
4653
|
close() {
|
|
4577
4654
|
this.group.model.closePanel(this.panel);
|
|
@@ -4593,7 +4670,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4593
4670
|
this.id = id;
|
|
4594
4671
|
this.containerApi = containerApi;
|
|
4595
4672
|
this.view = view;
|
|
4596
|
-
this._title = '';
|
|
4597
4673
|
this._group = group;
|
|
4598
4674
|
this.api = new DockviewPanelApiImpl(this, this._group);
|
|
4599
4675
|
this.addDisposables(this.api.onActiveChange(() => {
|
|
@@ -4606,8 +4682,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4606
4682
|
}
|
|
4607
4683
|
init(params) {
|
|
4608
4684
|
this._params = params.params;
|
|
4609
|
-
this.setTitle(params.title);
|
|
4610
4685
|
this.view.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));
|
|
4686
|
+
this.setTitle(params.title);
|
|
4611
4687
|
}
|
|
4612
4688
|
focus() {
|
|
4613
4689
|
this.api._onFocusEvent.fire();
|
|
@@ -4624,11 +4700,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4624
4700
|
};
|
|
4625
4701
|
}
|
|
4626
4702
|
setTitle(title) {
|
|
4627
|
-
|
|
4628
|
-
const didTitleChange = title !== ((_a = this._params) === null || _a === void 0 ? void 0 : _a.title);
|
|
4703
|
+
const didTitleChange = title !== this.title;
|
|
4629
4704
|
if (didTitleChange) {
|
|
4630
4705
|
this._title = title;
|
|
4631
|
-
|
|
4706
|
+
this.view.update({
|
|
4632
4707
|
params: {
|
|
4633
4708
|
params: this._params,
|
|
4634
4709
|
title: this.title,
|
|
@@ -4638,14 +4713,19 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4638
4713
|
}
|
|
4639
4714
|
}
|
|
4640
4715
|
update(event) {
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
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
|
+
}
|
|
4647
4726
|
}
|
|
4648
|
-
|
|
4727
|
+
// update the view with the updated props
|
|
4728
|
+
this.view.update({
|
|
4649
4729
|
params: {
|
|
4650
4730
|
params: this._params,
|
|
4651
4731
|
title: this.title,
|
|
@@ -5020,7 +5100,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5020
5100
|
size: { type: 'pixels', value: 20 },
|
|
5021
5101
|
},
|
|
5022
5102
|
});
|
|
5023
|
-
this.addDisposables(dropTarget
|
|
5103
|
+
this.addDisposables(dropTarget.onDrop((event) => {
|
|
5024
5104
|
const data = getPanelData();
|
|
5025
5105
|
if (data) {
|
|
5026
5106
|
this.moveGroupOrPanel(this.orthogonalize(event.position), data.groupId, data.panelId || undefined, 'center');
|
|
@@ -5028,7 +5108,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5028
5108
|
else {
|
|
5029
5109
|
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: null, getData: getPanelData }));
|
|
5030
5110
|
}
|
|
5031
|
-
}));
|
|
5111
|
+
}), dropTarget);
|
|
5032
5112
|
this._api = new DockviewApi(this);
|
|
5033
5113
|
this.updateWatermark();
|
|
5034
5114
|
}
|
|
@@ -5352,31 +5432,33 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5352
5432
|
}
|
|
5353
5433
|
super.doRemoveGroup(group, { skipActive });
|
|
5354
5434
|
}
|
|
5355
|
-
moveGroupOrPanel(
|
|
5435
|
+
moveGroupOrPanel(destinationGroup, sourceGroupId, sourceItemId, destinationTarget, destinationIndex) {
|
|
5356
5436
|
var _a;
|
|
5357
|
-
const sourceGroup =
|
|
5358
|
-
? (_a = this._groups.get(
|
|
5437
|
+
const sourceGroup = sourceGroupId
|
|
5438
|
+
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
5359
5439
|
: undefined;
|
|
5360
|
-
if (
|
|
5440
|
+
if (sourceItemId === undefined) {
|
|
5361
5441
|
if (sourceGroup) {
|
|
5362
|
-
this.moveGroup(sourceGroup,
|
|
5442
|
+
this.moveGroup(sourceGroup, destinationGroup, destinationTarget);
|
|
5363
5443
|
}
|
|
5364
5444
|
return;
|
|
5365
5445
|
}
|
|
5366
|
-
if (!
|
|
5367
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(
|
|
5368
|
-
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);
|
|
5369
5449
|
if (!groupItem) {
|
|
5370
|
-
throw new Error(`No panel with id ${
|
|
5450
|
+
throw new Error(`No panel with id ${sourceItemId}`);
|
|
5371
5451
|
}
|
|
5372
5452
|
if ((sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.size) === 0) {
|
|
5373
5453
|
this.doRemoveGroup(sourceGroup);
|
|
5374
5454
|
}
|
|
5375
|
-
|
|
5455
|
+
destinationGroup.model.openPanel(groupItem, {
|
|
5456
|
+
index: destinationIndex,
|
|
5457
|
+
});
|
|
5376
5458
|
}
|
|
5377
5459
|
else {
|
|
5378
|
-
const referenceLocation = getGridLocation(
|
|
5379
|
-
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation,
|
|
5460
|
+
const referenceLocation = getGridLocation(destinationGroup.element);
|
|
5461
|
+
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5380
5462
|
if (sourceGroup && sourceGroup.size < 2) {
|
|
5381
5463
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
5382
5464
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
@@ -5394,18 +5476,18 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5394
5476
|
skipDispose: true,
|
|
5395
5477
|
});
|
|
5396
5478
|
// after deleting the group we need to re-evaulate the ref location
|
|
5397
|
-
const updatedReferenceLocation = getGridLocation(
|
|
5398
|
-
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation,
|
|
5479
|
+
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
5480
|
+
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
5399
5481
|
this.doAddGroup(targetGroup, location);
|
|
5400
5482
|
}
|
|
5401
5483
|
}
|
|
5402
5484
|
else {
|
|
5403
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(
|
|
5404
|
-
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);
|
|
5405
5487
|
if (!groupItem) {
|
|
5406
|
-
throw new Error(`No panel with id ${
|
|
5488
|
+
throw new Error(`No panel with id ${sourceItemId}`);
|
|
5407
5489
|
}
|
|
5408
|
-
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation,
|
|
5490
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5409
5491
|
const group = this.createGroupAtLocation(dropLocation);
|
|
5410
5492
|
group.model.openPanel(groupItem);
|
|
5411
5493
|
}
|
|
@@ -5499,11 +5581,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5499
5581
|
return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
|
|
5500
5582
|
}
|
|
5501
5583
|
dispose() {
|
|
5502
|
-
super.dispose();
|
|
5503
5584
|
this._onDidActivePanelChange.dispose();
|
|
5504
5585
|
this._onDidAddPanel.dispose();
|
|
5505
5586
|
this._onDidRemovePanel.dispose();
|
|
5506
5587
|
this._onDidLayoutFromJSON.dispose();
|
|
5588
|
+
super.dispose();
|
|
5507
5589
|
}
|
|
5508
5590
|
}
|
|
5509
5591
|
|
|
@@ -5761,7 +5843,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5761
5843
|
}
|
|
5762
5844
|
set splitview(value) {
|
|
5763
5845
|
this._splitview = value;
|
|
5764
|
-
this.
|
|
5846
|
+
this._splitviewChangeDisposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
|
|
5765
5847
|
this._onDidLayoutChange.fire(undefined);
|
|
5766
5848
|
}), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
|
|
5767
5849
|
}
|
|
@@ -5783,7 +5865,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5783
5865
|
}
|
|
5784
5866
|
constructor(options) {
|
|
5785
5867
|
super(options.parentElement);
|
|
5786
|
-
this.
|
|
5868
|
+
this._splitviewChangeDisposable = new MutableDisposable();
|
|
5787
5869
|
this._panels = new Map();
|
|
5788
5870
|
this._onDidLayoutfromJSON = new Emitter();
|
|
5789
5871
|
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
@@ -5801,7 +5883,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5801
5883
|
options.frameworkComponents = {};
|
|
5802
5884
|
}
|
|
5803
5885
|
this.splitview = new Splitview(this.element, options);
|
|
5804
|
-
this.addDisposables(this.
|
|
5886
|
+
this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
|
|
5805
5887
|
}
|
|
5806
5888
|
updateOptions(options) {
|
|
5807
5889
|
const hasOrientationChanged = typeof options.orientation === 'string' &&
|
|
@@ -5839,15 +5921,15 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5839
5921
|
}
|
|
5840
5922
|
}
|
|
5841
5923
|
removePanel(panel, sizing) {
|
|
5842
|
-
const
|
|
5843
|
-
if (!
|
|
5924
|
+
const item = this._panels.get(panel.id);
|
|
5925
|
+
if (!item) {
|
|
5844
5926
|
throw new Error(`unknown splitview panel ${panel.id}`);
|
|
5845
5927
|
}
|
|
5846
|
-
|
|
5847
|
-
disposable.value.dispose();
|
|
5928
|
+
item.dispose();
|
|
5848
5929
|
this._panels.delete(panel.id);
|
|
5849
5930
|
const index = this.panels.findIndex((_) => _ === panel);
|
|
5850
|
-
this.splitview.removeView(index, sizing);
|
|
5931
|
+
const removedView = this.splitview.removeView(index, sizing);
|
|
5932
|
+
removedView.dispose();
|
|
5851
5933
|
const panels = this.panels;
|
|
5852
5934
|
if (panels.length > 0) {
|
|
5853
5935
|
this.setActive(panels[panels.length - 1]);
|
|
@@ -5894,7 +5976,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5894
5976
|
}
|
|
5895
5977
|
this.setActive(view, true);
|
|
5896
5978
|
});
|
|
5897
|
-
this._panels.set(view.id,
|
|
5979
|
+
this._panels.set(view.id, disposable);
|
|
5898
5980
|
}
|
|
5899
5981
|
toJSON() {
|
|
5900
5982
|
var _a;
|
|
@@ -5967,20 +6049,26 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5967
6049
|
this._onDidLayoutfromJSON.fire();
|
|
5968
6050
|
}
|
|
5969
6051
|
clear() {
|
|
5970
|
-
for (const
|
|
5971
|
-
|
|
5972
|
-
value.value.dispose();
|
|
6052
|
+
for (const disposable of this._panels.values()) {
|
|
6053
|
+
disposable.dispose();
|
|
5973
6054
|
}
|
|
5974
6055
|
this._panels.clear();
|
|
5975
|
-
this.splitview.
|
|
6056
|
+
while (this.splitview.length > 0) {
|
|
6057
|
+
const view = this.splitview.removeView(0, exports.Sizing.Distribute, true);
|
|
6058
|
+
view.dispose();
|
|
6059
|
+
}
|
|
5976
6060
|
}
|
|
5977
6061
|
dispose() {
|
|
5978
|
-
for (const
|
|
5979
|
-
|
|
5980
|
-
value.value.dispose();
|
|
6062
|
+
for (const disposable of this._panels.values()) {
|
|
6063
|
+
disposable.dispose();
|
|
5981
6064
|
}
|
|
5982
6065
|
this._panels.clear();
|
|
6066
|
+
const views = this.splitview.getViews();
|
|
6067
|
+
this._splitviewChangeDisposable.dispose();
|
|
5983
6068
|
this.splitview.dispose();
|
|
6069
|
+
for (const view of views) {
|
|
6070
|
+
view.dispose();
|
|
6071
|
+
}
|
|
5984
6072
|
super.dispose();
|
|
5985
6073
|
}
|
|
5986
6074
|
}
|