dockview-core 1.7.3 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/dockviewPanelApi.js +1 -1
- package/dist/cjs/api/dockviewPanelApi.js.map +1 -1
- package/dist/cjs/api/panelApi.d.ts.map +1 -1
- package/dist/cjs/api/panelApi.js +3 -5
- package/dist/cjs/api/panelApi.js.map +1 -1
- package/dist/cjs/dnd/abstractDragHandler.d.ts +2 -2
- package/dist/cjs/dnd/abstractDragHandler.d.ts.map +1 -1
- package/dist/cjs/dnd/abstractDragHandler.js +28 -23
- package/dist/cjs/dnd/abstractDragHandler.js.map +1 -1
- package/dist/cjs/dnd/droptarget.d.ts.map +1 -1
- package/dist/cjs/dnd/droptarget.js +1 -0
- package/dist/cjs/dnd/droptarget.js.map +1 -1
- package/dist/cjs/dnd/groupDragHandler.d.ts +0 -1
- package/dist/cjs/dnd/groupDragHandler.d.ts.map +1 -1
- package/dist/cjs/dnd/groupDragHandler.js +0 -3
- package/dist/cjs/dnd/groupDragHandler.js.map +1 -1
- package/dist/cjs/dockview/components/panel/content.d.ts.map +1 -1
- package/dist/cjs/dockview/components/panel/content.js +2 -2
- package/dist/cjs/dockview/components/panel/content.js.map +1 -1
- package/dist/cjs/dockview/components/tab/tab.d.ts +2 -2
- package/dist/cjs/dockview/components/tab/tab.d.ts.map +1 -1
- package/dist/cjs/dockview/components/tab/tab.js +2 -7
- package/dist/cjs/dockview/components/tab/tab.js.map +1 -1
- package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts.map +1 -1
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +27 -3
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.js +23 -21
- package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +2 -2
- package/dist/cjs/dockview/dockviewGroupPanelModel.js.map +1 -1
- package/dist/cjs/dockview/dockviewPanel.d.ts +5 -4
- package/dist/cjs/dockview/dockviewPanel.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewPanel.js +33 -5
- package/dist/cjs/dockview/dockviewPanel.js.map +1 -1
- package/dist/cjs/dockview/dockviewPanelModel.d.ts +4 -3
- package/dist/cjs/dockview/dockviewPanelModel.d.ts.map +1 -1
- package/dist/cjs/dockview/dockviewPanelModel.js.map +1 -1
- package/dist/cjs/dockview/types.d.ts +1 -5
- package/dist/cjs/dockview/types.d.ts.map +1 -1
- package/dist/cjs/dockview/types.js.map +1 -1
- package/dist/cjs/dom.js +1 -5
- package/dist/cjs/dom.js.map +1 -1
- package/dist/cjs/events.d.ts +17 -0
- package/dist/cjs/events.d.ts.map +1 -1
- package/dist/cjs/events.js +96 -9
- package/dist/cjs/events.js.map +1 -1
- package/dist/cjs/gridview/baseComponentGridview.d.ts.map +1 -1
- package/dist/cjs/gridview/baseComponentGridview.js +2 -3
- package/dist/cjs/gridview/baseComponentGridview.js.map +1 -1
- package/dist/cjs/gridview/basePanelView.d.ts.map +1 -1
- package/dist/cjs/gridview/basePanelView.js +41 -8
- package/dist/cjs/gridview/basePanelView.js.map +1 -1
- package/dist/cjs/gridview/branchNode.d.ts +1 -1
- package/dist/cjs/gridview/branchNode.d.ts.map +1 -1
- package/dist/cjs/gridview/branchNode.js +3 -3
- package/dist/cjs/gridview/branchNode.js.map +1 -1
- package/dist/cjs/gridview/gridview.d.ts.map +1 -1
- package/dist/cjs/gridview/gridview.js +4 -2
- package/dist/cjs/gridview/gridview.js.map +1 -1
- package/dist/cjs/gridview/gridviewPanel.js +2 -2
- package/dist/cjs/gridview/gridviewPanel.js.map +1 -1
- package/dist/cjs/lifecycle.d.ts +1 -1
- package/dist/cjs/lifecycle.d.ts.map +1 -1
- package/dist/cjs/lifecycle.js +3 -3
- package/dist/cjs/lifecycle.js.map +1 -1
- package/dist/cjs/splitview/splitview.d.ts +3 -2
- package/dist/cjs/splitview/splitview.d.ts.map +1 -1
- package/dist/cjs/splitview/splitview.js +103 -86
- package/dist/cjs/splitview/splitview.js.map +1 -1
- package/dist/cjs/splitview/splitviewComponent.d.ts +2 -2
- package/dist/cjs/splitview/splitviewComponent.d.ts.map +1 -1
- package/dist/cjs/splitview/splitviewComponent.js +36 -20
- package/dist/cjs/splitview/splitviewComponent.js.map +1 -1
- package/dist/cjs/splitview/splitviewPanel.d.ts.map +1 -1
- package/dist/cjs/splitview/splitviewPanel.js.map +1 -1
- package/dist/dockview-core.amd.js +281 -194
- package/dist/dockview-core.amd.min.js +2 -2
- package/dist/dockview-core.amd.min.noStyle.js +2 -2
- package/dist/dockview-core.amd.noStyle.js +281 -194
- package/dist/dockview-core.cjs.js +281 -194
- package/dist/dockview-core.esm.js +281 -194
- package/dist/dockview-core.esm.min.js +2 -2
- package/dist/dockview-core.js +281 -194
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.noStyle.js +281 -194
- package/dist/esm/api/dockviewPanelApi.js +1 -1
- package/dist/esm/api/dockviewPanelApi.js.map +1 -1
- package/dist/esm/api/panelApi.d.ts.map +1 -1
- package/dist/esm/api/panelApi.js +3 -5
- package/dist/esm/api/panelApi.js.map +1 -1
- package/dist/esm/dnd/abstractDragHandler.d.ts +2 -2
- package/dist/esm/dnd/abstractDragHandler.d.ts.map +1 -1
- package/dist/esm/dnd/abstractDragHandler.js +15 -10
- package/dist/esm/dnd/abstractDragHandler.js.map +1 -1
- package/dist/esm/dnd/droptarget.d.ts.map +1 -1
- package/dist/esm/dnd/droptarget.js +1 -0
- package/dist/esm/dnd/droptarget.js.map +1 -1
- package/dist/esm/dnd/groupDragHandler.d.ts +0 -1
- package/dist/esm/dnd/groupDragHandler.d.ts.map +1 -1
- package/dist/esm/dnd/groupDragHandler.js +0 -3
- package/dist/esm/dnd/groupDragHandler.js.map +1 -1
- package/dist/esm/dockview/components/panel/content.d.ts.map +1 -1
- package/dist/esm/dockview/components/panel/content.js +2 -2
- package/dist/esm/dockview/components/panel/content.js.map +1 -1
- package/dist/esm/dockview/components/tab/tab.d.ts +2 -2
- package/dist/esm/dockview/components/tab/tab.d.ts.map +1 -1
- package/dist/esm/dockview/components/tab/tab.js +2 -7
- package/dist/esm/dockview/components/tab/tab.js.map +1 -1
- package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts.map +1 -1
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +5 -3
- package/dist/esm/dockview/components/titlebar/tabsContainer.js.map +1 -1
- package/dist/esm/dockview/dockviewComponent.d.ts +1 -1
- package/dist/esm/dockview/dockviewComponent.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewComponent.js +23 -21
- package/dist/esm/dockview/dockviewComponent.js.map +1 -1
- package/dist/esm/dockview/dockviewGroupPanelModel.js +2 -2
- package/dist/esm/dockview/dockviewGroupPanelModel.js.map +1 -1
- package/dist/esm/dockview/dockviewPanel.d.ts +5 -4
- package/dist/esm/dockview/dockviewPanel.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewPanel.js +11 -5
- package/dist/esm/dockview/dockviewPanel.js.map +1 -1
- package/dist/esm/dockview/dockviewPanelModel.d.ts +4 -3
- package/dist/esm/dockview/dockviewPanelModel.d.ts.map +1 -1
- package/dist/esm/dockview/dockviewPanelModel.js.map +1 -1
- package/dist/esm/dockview/types.d.ts +1 -5
- package/dist/esm/dockview/types.d.ts.map +1 -1
- package/dist/esm/dockview/types.js.map +1 -1
- package/dist/esm/dom.js +1 -5
- package/dist/esm/dom.js.map +1 -1
- package/dist/esm/events.d.ts +17 -0
- package/dist/esm/events.d.ts.map +1 -1
- package/dist/esm/events.js +77 -9
- package/dist/esm/events.js.map +1 -1
- package/dist/esm/gridview/baseComponentGridview.d.ts.map +1 -1
- package/dist/esm/gridview/baseComponentGridview.js +2 -3
- package/dist/esm/gridview/baseComponentGridview.js.map +1 -1
- package/dist/esm/gridview/basePanelView.d.ts.map +1 -1
- package/dist/esm/gridview/basePanelView.js +16 -5
- package/dist/esm/gridview/basePanelView.js.map +1 -1
- package/dist/esm/gridview/branchNode.d.ts +1 -1
- package/dist/esm/gridview/branchNode.d.ts.map +1 -1
- package/dist/esm/gridview/branchNode.js +3 -3
- package/dist/esm/gridview/branchNode.js.map +1 -1
- package/dist/esm/gridview/gridview.d.ts.map +1 -1
- package/dist/esm/gridview/gridview.js +4 -2
- package/dist/esm/gridview/gridview.js.map +1 -1
- package/dist/esm/gridview/gridviewPanel.js +2 -2
- package/dist/esm/gridview/gridviewPanel.js.map +1 -1
- package/dist/esm/lifecycle.d.ts +1 -1
- package/dist/esm/lifecycle.d.ts.map +1 -1
- package/dist/esm/lifecycle.js +3 -3
- package/dist/esm/lifecycle.js.map +1 -1
- package/dist/esm/splitview/splitview.d.ts +3 -2
- package/dist/esm/splitview/splitview.d.ts.map +1 -1
- package/dist/esm/splitview/splitview.js +90 -86
- package/dist/esm/splitview/splitview.js.map +1 -1
- package/dist/esm/splitview/splitviewComponent.d.ts +2 -2
- package/dist/esm/splitview/splitviewComponent.d.ts.map +1 -1
- package/dist/esm/splitview/splitviewComponent.js +22 -16
- package/dist/esm/splitview/splitviewComponent.js.map +1 -1
- package/dist/esm/splitview/splitviewPanel.d.ts.map +1 -1
- package/dist/esm/splitview/splitviewPanel.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 1.7.
|
|
3
|
+
* @version 1.7.5
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -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,28 +154,50 @@ 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 {
|
|
136
199
|
dispose: () => {
|
|
137
|
-
element.removeEventListener(type, listener);
|
|
200
|
+
element.removeEventListener(type, listener, options);
|
|
138
201
|
},
|
|
139
202
|
};
|
|
140
203
|
}
|
|
@@ -142,7 +205,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
142
205
|
element.addEventListener(type, listener, options);
|
|
143
206
|
return {
|
|
144
207
|
dispose: () => {
|
|
145
|
-
element.removeEventListener(type, listener);
|
|
208
|
+
element.removeEventListener(type, listener, options);
|
|
146
209
|
},
|
|
147
210
|
};
|
|
148
211
|
}
|
|
@@ -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) {
|
|
@@ -907,12 +969,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
907
969
|
this.saveProportions();
|
|
908
970
|
document.removeEventListener('mousemove', mousemove);
|
|
909
971
|
document.removeEventListener('mouseup', end);
|
|
910
|
-
document.removeEventListener('mouseend', end);
|
|
911
972
|
this._onDidSashEnd.fire(undefined);
|
|
912
973
|
};
|
|
913
974
|
document.addEventListener('mousemove', mousemove);
|
|
914
975
|
document.addEventListener('mouseup', end);
|
|
915
|
-
document.addEventListener('mouseend', end);
|
|
916
976
|
};
|
|
917
977
|
sash.addEventListener('mousedown', onStart);
|
|
918
978
|
const sashItem = {
|
|
@@ -938,7 +998,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
938
998
|
distributeViewSizes() {
|
|
939
999
|
const flexibleViewItems = [];
|
|
940
1000
|
let flexibleSize = 0;
|
|
941
|
-
for (const item of this.
|
|
1001
|
+
for (const item of this.viewItems) {
|
|
942
1002
|
if (item.maximumSize - item.minimumSize > 0) {
|
|
943
1003
|
flexibleViewItems.push(item);
|
|
944
1004
|
flexibleSize += item.size;
|
|
@@ -948,17 +1008,17 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
948
1008
|
for (const item of flexibleViewItems) {
|
|
949
1009
|
item.size = clamp(size, item.minimumSize, item.maximumSize);
|
|
950
1010
|
}
|
|
951
|
-
const indexes = range(this.
|
|
952
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
953
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1011
|
+
const indexes = range(this.viewItems.length);
|
|
1012
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1013
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
954
1014
|
this.relayout(lowPriorityIndexes, highPriorityIndexes);
|
|
955
1015
|
}
|
|
956
1016
|
removeView(index, sizing, skipLayout = false) {
|
|
957
1017
|
// Remove view
|
|
958
|
-
const viewItem = this.
|
|
1018
|
+
const viewItem = this.viewItems.splice(index, 1)[0];
|
|
959
1019
|
viewItem.dispose();
|
|
960
1020
|
// Remove sash
|
|
961
|
-
if (this.
|
|
1021
|
+
if (this.viewItems.length >= 1) {
|
|
962
1022
|
const sashIndex = Math.max(index - 1, 0);
|
|
963
1023
|
const sashItem = this.sashes.splice(sashIndex, 1)[0];
|
|
964
1024
|
sashItem.disposable();
|
|
@@ -973,10 +1033,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
973
1033
|
return viewItem.view;
|
|
974
1034
|
}
|
|
975
1035
|
getViewCachedVisibleSize(index) {
|
|
976
|
-
if (index < 0 || index >= this.
|
|
1036
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
977
1037
|
throw new Error('Index out of bounds');
|
|
978
1038
|
}
|
|
979
|
-
const viewItem = this.
|
|
1039
|
+
const viewItem = this.viewItems[index];
|
|
980
1040
|
return viewItem.cachedVisibleSize;
|
|
981
1041
|
}
|
|
982
1042
|
moveView(from, to) {
|
|
@@ -992,14 +1052,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
992
1052
|
this.size = size;
|
|
993
1053
|
this.orthogonalSize = orthogonalSize;
|
|
994
1054
|
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.
|
|
1055
|
+
const indexes = range(this.viewItems.length);
|
|
1056
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1057
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1058
|
+
this.resize(this.viewItems.length - 1, size - previousSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
999
1059
|
}
|
|
1000
1060
|
else {
|
|
1001
|
-
for (let i = 0; i < this.
|
|
1002
|
-
const item = this.
|
|
1061
|
+
for (let i = 0; i < this.viewItems.length; i++) {
|
|
1062
|
+
const item = this.viewItems[i];
|
|
1003
1063
|
item.size = clamp(Math.round(this.proportions[i] * size), item.minimumSize, item.maximumSize);
|
|
1004
1064
|
}
|
|
1005
1065
|
}
|
|
@@ -1007,18 +1067,18 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1007
1067
|
this.layoutViews();
|
|
1008
1068
|
}
|
|
1009
1069
|
relayout(lowPriorityIndexes, highPriorityIndexes) {
|
|
1010
|
-
const contentSize = this.
|
|
1011
|
-
this.resize(this.
|
|
1070
|
+
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1071
|
+
this.resize(this.viewItems.length - 1, this._size - contentSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
1012
1072
|
this.distributeEmptySpace();
|
|
1013
1073
|
this.layoutViews();
|
|
1014
1074
|
this.saveProportions();
|
|
1015
1075
|
}
|
|
1016
1076
|
distributeEmptySpace(lowPriorityIndex) {
|
|
1017
|
-
const contentSize = this.
|
|
1077
|
+
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1018
1078
|
let emptyDelta = this.size - contentSize;
|
|
1019
|
-
const indexes = range(this.
|
|
1020
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
1021
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1079
|
+
const indexes = range(this.viewItems.length - 1, -1);
|
|
1080
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1081
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1022
1082
|
for (const index of highPriorityIndexes) {
|
|
1023
1083
|
pushToStart(indexes, index);
|
|
1024
1084
|
}
|
|
@@ -1029,7 +1089,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1029
1089
|
pushToEnd(indexes, lowPriorityIndex);
|
|
1030
1090
|
}
|
|
1031
1091
|
for (let i = 0; emptyDelta !== 0 && i < indexes.length; i++) {
|
|
1032
|
-
const item = this.
|
|
1092
|
+
const item = this.viewItems[indexes[i]];
|
|
1033
1093
|
const size = clamp(item.size + emptyDelta, item.minimumSize, item.maximumSize);
|
|
1034
1094
|
const viewDelta = size - item.size;
|
|
1035
1095
|
emptyDelta -= viewDelta;
|
|
@@ -1038,16 +1098,16 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1038
1098
|
}
|
|
1039
1099
|
saveProportions() {
|
|
1040
1100
|
if (this.proportionalLayout && this.contentSize > 0) {
|
|
1041
|
-
this._proportions = this.
|
|
1101
|
+
this._proportions = this.viewItems.map((i) => i.size / this.contentSize);
|
|
1042
1102
|
}
|
|
1043
1103
|
}
|
|
1044
1104
|
layoutViews() {
|
|
1045
|
-
this.contentSize = this.
|
|
1105
|
+
this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1046
1106
|
let sum = 0;
|
|
1047
1107
|
const x = [];
|
|
1048
1108
|
this.updateSashEnablement();
|
|
1049
|
-
for (let i = 0; i < this.
|
|
1050
|
-
sum += this.
|
|
1109
|
+
for (let i = 0; i < this.viewItems.length - 1; i++) {
|
|
1110
|
+
sum += this.viewItems[i].size;
|
|
1051
1111
|
x.push(sum);
|
|
1052
1112
|
const offset = Math.min(Math.max(0, sum - 2), this.size - 4);
|
|
1053
1113
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
@@ -1059,7 +1119,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1059
1119
|
this.sashes[i].container.style.top = `${offset}px`;
|
|
1060
1120
|
}
|
|
1061
1121
|
}
|
|
1062
|
-
this.
|
|
1122
|
+
this.viewItems.forEach((view, i) => {
|
|
1063
1123
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
1064
1124
|
view.container.style.width = `${view.size}px`;
|
|
1065
1125
|
view.container.style.left = i == 0 ? '0px' : `${x[i - 1]}px`;
|
|
@@ -1078,7 +1138,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1078
1138
|
findFirstSnapIndex(indexes) {
|
|
1079
1139
|
// visible views first
|
|
1080
1140
|
for (const index of indexes) {
|
|
1081
|
-
const viewItem = this.
|
|
1141
|
+
const viewItem = this.viewItems[index];
|
|
1082
1142
|
if (!viewItem.visible) {
|
|
1083
1143
|
continue;
|
|
1084
1144
|
}
|
|
@@ -1088,7 +1148,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1088
1148
|
}
|
|
1089
1149
|
// then, hidden views
|
|
1090
1150
|
for (const index of indexes) {
|
|
1091
|
-
const viewItem = this.
|
|
1151
|
+
const viewItem = this.viewItems[index];
|
|
1092
1152
|
if (viewItem.visible &&
|
|
1093
1153
|
viewItem.maximumSize - viewItem.minimumSize > 0) {
|
|
1094
1154
|
return undefined;
|
|
@@ -1101,10 +1161,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1101
1161
|
}
|
|
1102
1162
|
updateSashEnablement() {
|
|
1103
1163
|
let previous = false;
|
|
1104
|
-
const collapsesDown = this.
|
|
1164
|
+
const collapsesDown = this.viewItems.map((i) => (previous = i.size - i.minimumSize > 0 || previous));
|
|
1105
1165
|
previous = false;
|
|
1106
|
-
const expandsDown = this.
|
|
1107
|
-
const reverseViews = [...this.
|
|
1166
|
+
const expandsDown = this.viewItems.map((i) => (previous = i.maximumSize - i.size > 0 || previous));
|
|
1167
|
+
const reverseViews = [...this.viewItems].reverse();
|
|
1108
1168
|
previous = false;
|
|
1109
1169
|
const collapsesUp = reverseViews
|
|
1110
1170
|
.map((i) => (previous = i.size - i.minimumSize > 0 || previous))
|
|
@@ -1116,19 +1176,19 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1116
1176
|
let position = 0;
|
|
1117
1177
|
for (let index = 0; index < this.sashes.length; index++) {
|
|
1118
1178
|
const sash = this.sashes[index];
|
|
1119
|
-
const viewItem = this.
|
|
1179
|
+
const viewItem = this.viewItems[index];
|
|
1120
1180
|
position += viewItem.size;
|
|
1121
1181
|
const min = !(collapsesDown[index] && expandsUp[index + 1]);
|
|
1122
1182
|
const max = !(expandsDown[index] && collapsesUp[index + 1]);
|
|
1123
1183
|
if (min && max) {
|
|
1124
1184
|
const upIndexes = range(index, -1);
|
|
1125
|
-
const downIndexes = range(index + 1, this.
|
|
1185
|
+
const downIndexes = range(index + 1, this.viewItems.length);
|
|
1126
1186
|
const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);
|
|
1127
1187
|
const snapAfterIndex = this.findFirstSnapIndex(downIndexes);
|
|
1128
1188
|
const snappedBefore = typeof snapBeforeIndex === 'number' &&
|
|
1129
|
-
!this.
|
|
1189
|
+
!this.viewItems[snapBeforeIndex].visible;
|
|
1130
1190
|
const snappedAfter = typeof snapAfterIndex === 'number' &&
|
|
1131
|
-
!this.
|
|
1191
|
+
!this.viewItems[snapAfterIndex].visible;
|
|
1132
1192
|
if (snappedBefore &&
|
|
1133
1193
|
collapsesUp[index] &&
|
|
1134
1194
|
(position > 0 || this.startSnappingEnabled)) {
|
|
@@ -1188,6 +1248,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1188
1248
|
break;
|
|
1189
1249
|
}
|
|
1190
1250
|
}
|
|
1251
|
+
for (const viewItem of this.viewItems) {
|
|
1252
|
+
viewItem.dispose();
|
|
1253
|
+
}
|
|
1191
1254
|
this.element.remove();
|
|
1192
1255
|
}
|
|
1193
1256
|
}
|
|
@@ -1622,7 +1685,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1622
1685
|
throw new Error('Invalid index');
|
|
1623
1686
|
}
|
|
1624
1687
|
this.splitview.removeView(index, sizing);
|
|
1625
|
-
this._removeChild(index);
|
|
1688
|
+
return this._removeChild(index);
|
|
1626
1689
|
}
|
|
1627
1690
|
_addChild(node, index) {
|
|
1628
1691
|
this.children.splice(index, 0, node);
|
|
@@ -1644,10 +1707,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1644
1707
|
});
|
|
1645
1708
|
}
|
|
1646
1709
|
dispose() {
|
|
1647
|
-
super.dispose();
|
|
1648
1710
|
this._childrenDisposable.dispose();
|
|
1649
|
-
this.children.forEach((child) => child.dispose());
|
|
1650
1711
|
this.splitview.dispose();
|
|
1712
|
+
this.children.forEach((child) => child.dispose());
|
|
1713
|
+
super.dispose();
|
|
1651
1714
|
}
|
|
1652
1715
|
}
|
|
1653
1716
|
|
|
@@ -1877,7 +1940,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1877
1940
|
if (oldRoot.children.length === 1) {
|
|
1878
1941
|
// can remove one level of redundant branching if there is only a single child
|
|
1879
1942
|
const childReference = oldRoot.children[0];
|
|
1880
|
-
oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
1943
|
+
const child = oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
1944
|
+
child.dispose();
|
|
1881
1945
|
oldRoot.dispose();
|
|
1882
1946
|
this._root.addChild(
|
|
1883
1947
|
/**
|
|
@@ -1984,7 +2048,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
1984
2048
|
if (typeof newSiblingCachedVisibleSize === 'number') {
|
|
1985
2049
|
newSiblingSize = exports.Sizing.Invisible(newSiblingCachedVisibleSize);
|
|
1986
2050
|
}
|
|
1987
|
-
grandParent.removeChild(parentIndex);
|
|
2051
|
+
const child = grandParent.removeChild(parentIndex);
|
|
2052
|
+
child.dispose();
|
|
1988
2053
|
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize);
|
|
1989
2054
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
1990
2055
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
@@ -2546,6 +2611,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2546
2611
|
}
|
|
2547
2612
|
dispose() {
|
|
2548
2613
|
this.removeDropTarget();
|
|
2614
|
+
super.dispose();
|
|
2549
2615
|
}
|
|
2550
2616
|
toggleClasses(quadrant, width, height) {
|
|
2551
2617
|
var _a, _b, _c, _d;
|
|
@@ -2723,8 +2789,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2723
2789
|
if (this.panel.view) {
|
|
2724
2790
|
const _onDidFocus = this.panel.view.content.onDidFocus;
|
|
2725
2791
|
const _onDidBlur = this.panel.view.content.onDidBlur;
|
|
2726
|
-
const
|
|
2727
|
-
disposable.addDisposables(onDidFocus(() => this._onDidFocus.fire()), onDidBlur(() => this._onDidBlur.fire()));
|
|
2792
|
+
const focusTracker = trackFocus(this._element);
|
|
2793
|
+
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
|
|
2728
2794
|
if (_onDidFocus) {
|
|
2729
2795
|
disposable.addDisposables(_onDidFocus(() => this._onDidFocus.fire()));
|
|
2730
2796
|
}
|
|
@@ -2763,24 +2829,32 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2763
2829
|
constructor(el) {
|
|
2764
2830
|
super();
|
|
2765
2831
|
this.el = el;
|
|
2766
|
-
this.
|
|
2832
|
+
this.dataDisposable = new MutableDisposable();
|
|
2833
|
+
this.pointerEventsDisposable = new MutableDisposable();
|
|
2767
2834
|
this._onDragStart = new Emitter();
|
|
2768
2835
|
this.onDragStart = this._onDragStart.event;
|
|
2769
|
-
this.
|
|
2836
|
+
this.addDisposables(this._onDragStart, this.dataDisposable, this.pointerEventsDisposable);
|
|
2770
2837
|
this.configure();
|
|
2771
2838
|
}
|
|
2772
2839
|
configure() {
|
|
2773
2840
|
this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
|
|
2774
|
-
|
|
2841
|
+
const iframes = [
|
|
2775
2842
|
...getElementsByTagName('iframe'),
|
|
2776
2843
|
...getElementsByTagName('webview'),
|
|
2777
2844
|
];
|
|
2778
|
-
|
|
2845
|
+
this.pointerEventsDisposable.value = {
|
|
2846
|
+
dispose: () => {
|
|
2847
|
+
for (const iframe of iframes) {
|
|
2848
|
+
iframe.style.pointerEvents = 'auto';
|
|
2849
|
+
}
|
|
2850
|
+
},
|
|
2851
|
+
};
|
|
2852
|
+
for (const iframe of iframes) {
|
|
2779
2853
|
iframe.style.pointerEvents = 'none';
|
|
2780
2854
|
}
|
|
2781
2855
|
this.el.classList.add('dv-dragged');
|
|
2782
2856
|
setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
|
|
2783
|
-
this.
|
|
2857
|
+
this.dataDisposable.value = this.getData(event.dataTransfer);
|
|
2784
2858
|
if (event.dataTransfer) {
|
|
2785
2859
|
event.dataTransfer.effectAllowed = 'move';
|
|
2786
2860
|
/**
|
|
@@ -2795,11 +2869,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2795
2869
|
event.dataTransfer.setData('text/plain', '__dockview_internal_drag_event__');
|
|
2796
2870
|
}
|
|
2797
2871
|
}), addDisposableListener(this.el, 'dragend', () => {
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
}
|
|
2801
|
-
this.iframes = [];
|
|
2802
|
-
this.disposable.dispose();
|
|
2872
|
+
this.pointerEventsDisposable.dispose();
|
|
2873
|
+
this.dataDisposable.dispose();
|
|
2803
2874
|
}));
|
|
2804
2875
|
}
|
|
2805
2876
|
}
|
|
@@ -2817,13 +2888,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2817
2888
|
this.onChanged = this._onChanged.event;
|
|
2818
2889
|
this._onDropped = new Emitter();
|
|
2819
2890
|
this.onDrop = this._onDropped.event;
|
|
2820
|
-
this.addDisposables(this._onChanged, this._onDropped);
|
|
2821
2891
|
this._element = document.createElement('div');
|
|
2822
2892
|
this._element.className = 'tab';
|
|
2823
2893
|
this._element.tabIndex = 0;
|
|
2824
2894
|
this._element.draggable = true;
|
|
2825
2895
|
toggleClass(this.element, 'inactive-tab', true);
|
|
2826
|
-
this.addDisposables(new (class Handler extends DragHandler {
|
|
2896
|
+
this.addDisposables(this._onChanged, this._onDropped, new (class Handler extends DragHandler {
|
|
2827
2897
|
constructor() {
|
|
2828
2898
|
super(...arguments);
|
|
2829
2899
|
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
@@ -2836,9 +2906,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2836
2906
|
},
|
|
2837
2907
|
};
|
|
2838
2908
|
}
|
|
2839
|
-
dispose() {
|
|
2840
|
-
//
|
|
2841
|
-
}
|
|
2842
2909
|
})(this._element));
|
|
2843
2910
|
this.addDisposables(addDisposableListener(this._element, 'mousedown', (event) => {
|
|
2844
2911
|
if (event.defaultPrevented) {
|
|
@@ -2873,7 +2940,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2873
2940
|
});
|
|
2874
2941
|
this.addDisposables(this.droptarget.onDrop((event) => {
|
|
2875
2942
|
this._onDropped.fire(event);
|
|
2876
|
-
}));
|
|
2943
|
+
}), this.droptarget);
|
|
2877
2944
|
}
|
|
2878
2945
|
setActive(isActive) {
|
|
2879
2946
|
toggleClass(this.element, 'active-tab', isActive);
|
|
@@ -2888,7 +2955,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2888
2955
|
}
|
|
2889
2956
|
dispose() {
|
|
2890
2957
|
super.dispose();
|
|
2891
|
-
this.droptarget.dispose();
|
|
2892
2958
|
}
|
|
2893
2959
|
}
|
|
2894
2960
|
|
|
@@ -2934,9 +3000,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2934
3000
|
},
|
|
2935
3001
|
};
|
|
2936
3002
|
}
|
|
2937
|
-
dispose() {
|
|
2938
|
-
//
|
|
2939
|
-
}
|
|
2940
3003
|
}
|
|
2941
3004
|
|
|
2942
3005
|
class VoidContainer extends CompositeDisposable {
|
|
@@ -3092,6 +3155,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3092
3155
|
const tabToRemove = this.tabs.splice(index, 1)[0];
|
|
3093
3156
|
const { value, disposable } = tabToRemove;
|
|
3094
3157
|
disposable.dispose();
|
|
3158
|
+
value.dispose();
|
|
3095
3159
|
value.element.remove();
|
|
3096
3160
|
}
|
|
3097
3161
|
setActivePanel(panel) {
|
|
@@ -3135,9 +3199,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3135
3199
|
}
|
|
3136
3200
|
dispose() {
|
|
3137
3201
|
super.dispose();
|
|
3138
|
-
this.tabs
|
|
3139
|
-
|
|
3140
|
-
|
|
3202
|
+
for (const { value, disposable } of this.tabs) {
|
|
3203
|
+
disposable.dispose();
|
|
3204
|
+
value.dispose();
|
|
3205
|
+
}
|
|
3141
3206
|
this.tabs = [];
|
|
3142
3207
|
}
|
|
3143
3208
|
}
|
|
@@ -3235,7 +3300,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3235
3300
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
3236
3301
|
this.header.hidden = !!options.hideHeader;
|
|
3237
3302
|
this.locked = !!options.locked;
|
|
3238
|
-
this.addDisposables(this.
|
|
3303
|
+
this.addDisposables(this.tabsContainer.onDrop((event) => {
|
|
3239
3304
|
this.handleDropEvent(event.event, 'center', event.index);
|
|
3240
3305
|
}), this.contentContainer.onDidFocus(() => {
|
|
3241
3306
|
this.accessor.doSetGroupActive(this.groupPanel, true);
|
|
@@ -3243,7 +3308,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3243
3308
|
// noop
|
|
3244
3309
|
}), this.dropTarget.onDrop((event) => {
|
|
3245
3310
|
this.handleDropEvent(event.nativeEvent, event.position);
|
|
3246
|
-
}));
|
|
3311
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
3247
3312
|
}
|
|
3248
3313
|
initialize() {
|
|
3249
3314
|
var _a, _b;
|
|
@@ -3677,8 +3742,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3677
3742
|
this.layout(0, 0, true); // set some elements height/widths
|
|
3678
3743
|
this.addDisposables(this.gridview.onDidChange(() => {
|
|
3679
3744
|
this._bufferOnDidLayoutChange.fire();
|
|
3680
|
-
}))
|
|
3681
|
-
this.addDisposables(exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3745
|
+
}), exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3682
3746
|
this._bufferOnDidLayoutChange.fire();
|
|
3683
3747
|
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
3684
3748
|
this._onDidLayoutChange.fire();
|
|
@@ -3781,7 +3845,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3781
3845
|
this.gridview.layout(width, height);
|
|
3782
3846
|
}
|
|
3783
3847
|
dispose() {
|
|
3784
|
-
super.dispose();
|
|
3785
3848
|
this._onDidActiveGroupChange.dispose();
|
|
3786
3849
|
this._onDidAddGroup.dispose();
|
|
3787
3850
|
this._onDidRemoveGroup.dispose();
|
|
@@ -3790,6 +3853,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3790
3853
|
group.dispose();
|
|
3791
3854
|
}
|
|
3792
3855
|
this.gridview.dispose();
|
|
3856
|
+
super.dispose();
|
|
3793
3857
|
}
|
|
3794
3858
|
}
|
|
3795
3859
|
|
|
@@ -3853,7 +3917,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3853
3917
|
//
|
|
3854
3918
|
this._onUpdateParameters = new Emitter();
|
|
3855
3919
|
this.onUpdateParameters = this._onUpdateParameters.event;
|
|
3856
|
-
this.addDisposables(this.
|
|
3920
|
+
this.addDisposables(this.onDidFocusChange((event) => {
|
|
3857
3921
|
this._isFocused = event.isFocused;
|
|
3858
3922
|
}), this.onDidActiveChange((event) => {
|
|
3859
3923
|
this._isActive = event.isActive;
|
|
@@ -3862,14 +3926,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3862
3926
|
}), this.onDidDimensionsChange((event) => {
|
|
3863
3927
|
this._width = event.width;
|
|
3864
3928
|
this._height = event.height;
|
|
3865
|
-
}));
|
|
3929
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onFocusEvent, this._onActiveChange, this._onVisibilityChange, this._onUpdateParameters);
|
|
3866
3930
|
}
|
|
3867
3931
|
initialize(panel) {
|
|
3868
3932
|
this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
|
|
3869
3933
|
panel.update({
|
|
3870
|
-
params:
|
|
3871
|
-
params: parameters,
|
|
3872
|
-
},
|
|
3934
|
+
params: parameters,
|
|
3873
3935
|
});
|
|
3874
3936
|
});
|
|
3875
3937
|
}
|
|
@@ -3964,12 +4026,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3964
4026
|
this._element.style.height = '100%';
|
|
3965
4027
|
this._element.style.width = '100%';
|
|
3966
4028
|
this._element.style.overflow = 'hidden';
|
|
3967
|
-
const
|
|
3968
|
-
this.addDisposables(this.api, onDidFocus(() => {
|
|
4029
|
+
const focusTracker = trackFocus(this._element);
|
|
4030
|
+
this.addDisposables(this.api, focusTracker.onDidFocus(() => {
|
|
3969
4031
|
this.api._onDidChangeFocus.fire({ isFocused: true });
|
|
3970
|
-
}), onDidBlur(() => {
|
|
4032
|
+
}), focusTracker.onDidBlur(() => {
|
|
3971
4033
|
this.api._onDidChangeFocus.fire({ isFocused: false });
|
|
3972
|
-
}));
|
|
4034
|
+
}), focusTracker);
|
|
3973
4035
|
}
|
|
3974
4036
|
focus() {
|
|
3975
4037
|
this.api._onFocusEvent.fire();
|
|
@@ -3990,7 +4052,18 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3990
4052
|
}
|
|
3991
4053
|
update(event) {
|
|
3992
4054
|
var _a, _b;
|
|
4055
|
+
// merge the new parameters with the existing parameters
|
|
3993
4056
|
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) });
|
|
4057
|
+
/**
|
|
4058
|
+
* delete new keys that have a value of undefined,
|
|
4059
|
+
* allow values of null
|
|
4060
|
+
*/
|
|
4061
|
+
for (const key of Object.keys(event.params)) {
|
|
4062
|
+
if (event.params[key] === undefined) {
|
|
4063
|
+
delete this._params.params[key];
|
|
4064
|
+
}
|
|
4065
|
+
}
|
|
4066
|
+
// update the view with the updated props
|
|
3994
4067
|
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
|
|
3995
4068
|
}
|
|
3996
4069
|
toJSON() {
|
|
@@ -4004,9 +4077,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4004
4077
|
}
|
|
4005
4078
|
dispose() {
|
|
4006
4079
|
var _a;
|
|
4007
|
-
super.dispose();
|
|
4008
4080
|
this.api.dispose();
|
|
4009
4081
|
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
4082
|
+
super.dispose();
|
|
4010
4083
|
}
|
|
4011
4084
|
}
|
|
4012
4085
|
|
|
@@ -4385,7 +4458,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4385
4458
|
this._maximumHeight = options.maximumHeight;
|
|
4386
4459
|
}
|
|
4387
4460
|
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
|
|
4388
|
-
this.addDisposables(this.
|
|
4461
|
+
this.addDisposables(this.api.onVisibilityChange((event) => {
|
|
4389
4462
|
const { isVisible } = event;
|
|
4390
4463
|
const { accessor } = this._params;
|
|
4391
4464
|
accessor.setVisible(this, isVisible);
|
|
@@ -4414,7 +4487,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4414
4487
|
height: event.height,
|
|
4415
4488
|
width: event.width,
|
|
4416
4489
|
});
|
|
4417
|
-
}));
|
|
4490
|
+
}), this._onDidChange);
|
|
4418
4491
|
}
|
|
4419
4492
|
setVisible(isVisible) {
|
|
4420
4493
|
this.api._onDidVisibilityChange.fire({ isVisible });
|
|
@@ -4571,7 +4644,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4571
4644
|
this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
|
|
4572
4645
|
}
|
|
4573
4646
|
setTitle(title) {
|
|
4574
|
-
this.panel.
|
|
4647
|
+
this.panel.setTitle(title);
|
|
4575
4648
|
}
|
|
4576
4649
|
close() {
|
|
4577
4650
|
this.group.model.closePanel(this.panel);
|
|
@@ -4636,12 +4709,18 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4636
4709
|
}
|
|
4637
4710
|
}
|
|
4638
4711
|
update(event) {
|
|
4639
|
-
|
|
4640
|
-
this._params = Object.assign(Object.assign({}, (this._params || {})), event.params
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4712
|
+
// merge the new parameters with the existing parameters
|
|
4713
|
+
this._params = Object.assign(Object.assign({}, (this._params || {})), event.params);
|
|
4714
|
+
/**
|
|
4715
|
+
* delete new keys that have a value of undefined,
|
|
4716
|
+
* allow values of null
|
|
4717
|
+
*/
|
|
4718
|
+
for (const key of Object.keys(event.params)) {
|
|
4719
|
+
if (event.params[key] === undefined) {
|
|
4720
|
+
delete this._params[key];
|
|
4721
|
+
}
|
|
4644
4722
|
}
|
|
4723
|
+
// update the view with the updated props
|
|
4645
4724
|
this.view.update({
|
|
4646
4725
|
params: {
|
|
4647
4726
|
params: this._params,
|
|
@@ -5017,7 +5096,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5017
5096
|
size: { type: 'pixels', value: 20 },
|
|
5018
5097
|
},
|
|
5019
5098
|
});
|
|
5020
|
-
this.addDisposables(dropTarget
|
|
5099
|
+
this.addDisposables(dropTarget.onDrop((event) => {
|
|
5021
5100
|
const data = getPanelData();
|
|
5022
5101
|
if (data) {
|
|
5023
5102
|
this.moveGroupOrPanel(this.orthogonalize(event.position), data.groupId, data.panelId || undefined, 'center');
|
|
@@ -5025,7 +5104,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5025
5104
|
else {
|
|
5026
5105
|
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: null, getData: getPanelData }));
|
|
5027
5106
|
}
|
|
5028
|
-
}));
|
|
5107
|
+
}), dropTarget);
|
|
5029
5108
|
this._api = new DockviewApi(this);
|
|
5030
5109
|
this.updateWatermark();
|
|
5031
5110
|
}
|
|
@@ -5349,31 +5428,33 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5349
5428
|
}
|
|
5350
5429
|
super.doRemoveGroup(group, { skipActive });
|
|
5351
5430
|
}
|
|
5352
|
-
moveGroupOrPanel(
|
|
5431
|
+
moveGroupOrPanel(destinationGroup, sourceGroupId, sourceItemId, destinationTarget, destinationIndex) {
|
|
5353
5432
|
var _a;
|
|
5354
|
-
const sourceGroup =
|
|
5355
|
-
? (_a = this._groups.get(
|
|
5433
|
+
const sourceGroup = sourceGroupId
|
|
5434
|
+
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
5356
5435
|
: undefined;
|
|
5357
|
-
if (
|
|
5436
|
+
if (sourceItemId === undefined) {
|
|
5358
5437
|
if (sourceGroup) {
|
|
5359
|
-
this.moveGroup(sourceGroup,
|
|
5438
|
+
this.moveGroup(sourceGroup, destinationGroup, destinationTarget);
|
|
5360
5439
|
}
|
|
5361
5440
|
return;
|
|
5362
5441
|
}
|
|
5363
|
-
if (!
|
|
5364
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(
|
|
5365
|
-
this.panels.find((panel) => panel.id ===
|
|
5442
|
+
if (!destinationTarget || destinationTarget === 'center') {
|
|
5443
|
+
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(sourceItemId)) ||
|
|
5444
|
+
this.panels.find((panel) => panel.id === sourceItemId);
|
|
5366
5445
|
if (!groupItem) {
|
|
5367
|
-
throw new Error(`No panel with id ${
|
|
5446
|
+
throw new Error(`No panel with id ${sourceItemId}`);
|
|
5368
5447
|
}
|
|
5369
5448
|
if ((sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.size) === 0) {
|
|
5370
5449
|
this.doRemoveGroup(sourceGroup);
|
|
5371
5450
|
}
|
|
5372
|
-
|
|
5451
|
+
destinationGroup.model.openPanel(groupItem, {
|
|
5452
|
+
index: destinationIndex,
|
|
5453
|
+
});
|
|
5373
5454
|
}
|
|
5374
5455
|
else {
|
|
5375
|
-
const referenceLocation = getGridLocation(
|
|
5376
|
-
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation,
|
|
5456
|
+
const referenceLocation = getGridLocation(destinationGroup.element);
|
|
5457
|
+
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5377
5458
|
if (sourceGroup && sourceGroup.size < 2) {
|
|
5378
5459
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
5379
5460
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
@@ -5391,18 +5472,18 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5391
5472
|
skipDispose: true,
|
|
5392
5473
|
});
|
|
5393
5474
|
// after deleting the group we need to re-evaulate the ref location
|
|
5394
|
-
const updatedReferenceLocation = getGridLocation(
|
|
5395
|
-
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation,
|
|
5475
|
+
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
5476
|
+
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
5396
5477
|
this.doAddGroup(targetGroup, location);
|
|
5397
5478
|
}
|
|
5398
5479
|
}
|
|
5399
5480
|
else {
|
|
5400
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(
|
|
5401
|
-
this.panels.find((panel) => panel.id ===
|
|
5481
|
+
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(sourceItemId)) ||
|
|
5482
|
+
this.panels.find((panel) => panel.id === sourceItemId);
|
|
5402
5483
|
if (!groupItem) {
|
|
5403
|
-
throw new Error(`No panel with id ${
|
|
5484
|
+
throw new Error(`No panel with id ${sourceItemId}`);
|
|
5404
5485
|
}
|
|
5405
|
-
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation,
|
|
5486
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5406
5487
|
const group = this.createGroupAtLocation(dropLocation);
|
|
5407
5488
|
group.model.openPanel(groupItem);
|
|
5408
5489
|
}
|
|
@@ -5496,11 +5577,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5496
5577
|
return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
|
|
5497
5578
|
}
|
|
5498
5579
|
dispose() {
|
|
5499
|
-
super.dispose();
|
|
5500
5580
|
this._onDidActivePanelChange.dispose();
|
|
5501
5581
|
this._onDidAddPanel.dispose();
|
|
5502
5582
|
this._onDidRemovePanel.dispose();
|
|
5503
5583
|
this._onDidLayoutFromJSON.dispose();
|
|
5584
|
+
super.dispose();
|
|
5504
5585
|
}
|
|
5505
5586
|
}
|
|
5506
5587
|
|
|
@@ -5758,7 +5839,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5758
5839
|
}
|
|
5759
5840
|
set splitview(value) {
|
|
5760
5841
|
this._splitview = value;
|
|
5761
|
-
this.
|
|
5842
|
+
this._splitviewChangeDisposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
|
|
5762
5843
|
this._onDidLayoutChange.fire(undefined);
|
|
5763
5844
|
}), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
|
|
5764
5845
|
}
|
|
@@ -5780,7 +5861,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5780
5861
|
}
|
|
5781
5862
|
constructor(options) {
|
|
5782
5863
|
super(options.parentElement);
|
|
5783
|
-
this.
|
|
5864
|
+
this._splitviewChangeDisposable = new MutableDisposable();
|
|
5784
5865
|
this._panels = new Map();
|
|
5785
5866
|
this._onDidLayoutfromJSON = new Emitter();
|
|
5786
5867
|
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
@@ -5798,7 +5879,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5798
5879
|
options.frameworkComponents = {};
|
|
5799
5880
|
}
|
|
5800
5881
|
this.splitview = new Splitview(this.element, options);
|
|
5801
|
-
this.addDisposables(this.
|
|
5882
|
+
this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
|
|
5802
5883
|
}
|
|
5803
5884
|
updateOptions(options) {
|
|
5804
5885
|
const hasOrientationChanged = typeof options.orientation === 'string' &&
|
|
@@ -5836,15 +5917,15 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5836
5917
|
}
|
|
5837
5918
|
}
|
|
5838
5919
|
removePanel(panel, sizing) {
|
|
5839
|
-
const
|
|
5840
|
-
if (!
|
|
5920
|
+
const item = this._panels.get(panel.id);
|
|
5921
|
+
if (!item) {
|
|
5841
5922
|
throw new Error(`unknown splitview panel ${panel.id}`);
|
|
5842
5923
|
}
|
|
5843
|
-
|
|
5844
|
-
disposable.value.dispose();
|
|
5924
|
+
item.dispose();
|
|
5845
5925
|
this._panels.delete(panel.id);
|
|
5846
5926
|
const index = this.panels.findIndex((_) => _ === panel);
|
|
5847
|
-
this.splitview.removeView(index, sizing);
|
|
5927
|
+
const removedView = this.splitview.removeView(index, sizing);
|
|
5928
|
+
removedView.dispose();
|
|
5848
5929
|
const panels = this.panels;
|
|
5849
5930
|
if (panels.length > 0) {
|
|
5850
5931
|
this.setActive(panels[panels.length - 1]);
|
|
@@ -5891,7 +5972,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5891
5972
|
}
|
|
5892
5973
|
this.setActive(view, true);
|
|
5893
5974
|
});
|
|
5894
|
-
this._panels.set(view.id,
|
|
5975
|
+
this._panels.set(view.id, disposable);
|
|
5895
5976
|
}
|
|
5896
5977
|
toJSON() {
|
|
5897
5978
|
var _a;
|
|
@@ -5964,20 +6045,26 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5964
6045
|
this._onDidLayoutfromJSON.fire();
|
|
5965
6046
|
}
|
|
5966
6047
|
clear() {
|
|
5967
|
-
for (const
|
|
5968
|
-
|
|
5969
|
-
value.value.dispose();
|
|
6048
|
+
for (const disposable of this._panels.values()) {
|
|
6049
|
+
disposable.dispose();
|
|
5970
6050
|
}
|
|
5971
6051
|
this._panels.clear();
|
|
5972
|
-
this.splitview.
|
|
6052
|
+
while (this.splitview.length > 0) {
|
|
6053
|
+
const view = this.splitview.removeView(0, exports.Sizing.Distribute, true);
|
|
6054
|
+
view.dispose();
|
|
6055
|
+
}
|
|
5973
6056
|
}
|
|
5974
6057
|
dispose() {
|
|
5975
|
-
for (const
|
|
5976
|
-
|
|
5977
|
-
value.value.dispose();
|
|
6058
|
+
for (const disposable of this._panels.values()) {
|
|
6059
|
+
disposable.dispose();
|
|
5978
6060
|
}
|
|
5979
6061
|
this._panels.clear();
|
|
6062
|
+
const views = this.splitview.getViews();
|
|
6063
|
+
this._splitviewChangeDisposable.dispose();
|
|
5980
6064
|
this.splitview.dispose();
|
|
6065
|
+
for (const view of views) {
|
|
6066
|
+
view.dispose();
|
|
6067
|
+
}
|
|
5981
6068
|
super.dispose();
|
|
5982
6069
|
}
|
|
5983
6070
|
}
|