dockview 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/dockview.amd.js +284 -196
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.noStyle.js +284 -196
- package/dist/dockview.cjs.js +284 -196
- package/dist/dockview.esm.js +284 -196
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.js +284 -196
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.noStyle.js +284 -196
- package/package.json +4 -5
package/dist/dockview.amd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 1.7.
|
|
3
|
+
* @version 1.7.4
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -141,9 +141,49 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
141
141
|
};
|
|
142
142
|
};
|
|
143
143
|
})(exports.DockviewEvent || (exports.DockviewEvent = {}));
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
class LeakageMonitor {
|
|
145
|
+
constructor() {
|
|
146
|
+
this.events = new Map();
|
|
147
|
+
}
|
|
148
|
+
get size() {
|
|
149
|
+
return this.events.size;
|
|
150
|
+
}
|
|
151
|
+
add(event, stacktrace) {
|
|
152
|
+
this.events.set(event, stacktrace);
|
|
153
|
+
}
|
|
154
|
+
delete(event) {
|
|
155
|
+
this.events.delete(event);
|
|
156
|
+
}
|
|
157
|
+
clear() {
|
|
158
|
+
this.events.clear();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
class Stacktrace {
|
|
162
|
+
static create() {
|
|
163
|
+
var _a;
|
|
164
|
+
return new Stacktrace((_a = new Error().stack) !== null && _a !== void 0 ? _a : '');
|
|
165
|
+
}
|
|
166
|
+
constructor(value) {
|
|
167
|
+
this.value = value;
|
|
168
|
+
}
|
|
169
|
+
print() {
|
|
170
|
+
console.warn(this.value);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
class Listener {
|
|
174
|
+
constructor(callback, stacktrace) {
|
|
175
|
+
this.callback = callback;
|
|
176
|
+
this.stacktrace = stacktrace;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
// relatively simple event emitter taken from https://github.com/microsoft/vscode/blob/master/src/vs/base/common/event.ts
|
|
146
180
|
class Emitter {
|
|
181
|
+
static setLeakageMonitorEnabled(isEnabled) {
|
|
182
|
+
if (isEnabled !== Emitter.ENABLE_TRACKING) {
|
|
183
|
+
Emitter.MEMORY_LEAK_WATCHER.clear();
|
|
184
|
+
}
|
|
185
|
+
Emitter.ENABLE_TRACKING = isEnabled;
|
|
186
|
+
}
|
|
147
187
|
constructor(options) {
|
|
148
188
|
this.options = options;
|
|
149
189
|
this._listeners = [];
|
|
@@ -151,11 +191,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
151
191
|
}
|
|
152
192
|
get event() {
|
|
153
193
|
if (!this._event) {
|
|
154
|
-
this._event = (
|
|
194
|
+
this._event = (callback) => {
|
|
155
195
|
var _a;
|
|
156
196
|
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) && this._last !== undefined) {
|
|
157
|
-
|
|
197
|
+
callback(this._last);
|
|
158
198
|
}
|
|
199
|
+
const listener = new Listener(callback, Emitter.ENABLE_TRACKING ? Stacktrace.create() : undefined);
|
|
159
200
|
this._listeners.push(listener);
|
|
160
201
|
return {
|
|
161
202
|
dispose: () => {
|
|
@@ -163,23 +204,45 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
163
204
|
if (index > -1) {
|
|
164
205
|
this._listeners.splice(index, 1);
|
|
165
206
|
}
|
|
207
|
+
else if (Emitter.ENABLE_TRACKING) ;
|
|
166
208
|
},
|
|
167
209
|
};
|
|
168
210
|
};
|
|
211
|
+
if (Emitter.ENABLE_TRACKING) {
|
|
212
|
+
Emitter.MEMORY_LEAK_WATCHER.add(this._event, Stacktrace.create());
|
|
213
|
+
}
|
|
169
214
|
}
|
|
170
215
|
return this._event;
|
|
171
216
|
}
|
|
172
217
|
fire(e) {
|
|
173
218
|
this._last = e;
|
|
174
219
|
for (const listener of this._listeners) {
|
|
175
|
-
listener(e);
|
|
220
|
+
listener.callback(e);
|
|
176
221
|
}
|
|
177
222
|
}
|
|
178
223
|
dispose() {
|
|
179
|
-
this.
|
|
180
|
-
|
|
224
|
+
if (!this._disposed) {
|
|
225
|
+
this._disposed = true;
|
|
226
|
+
if (this._listeners.length > 0) {
|
|
227
|
+
if (Emitter.ENABLE_TRACKING) {
|
|
228
|
+
queueMicrotask(() => {
|
|
229
|
+
var _a;
|
|
230
|
+
// don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block
|
|
231
|
+
for (const listener of this._listeners) {
|
|
232
|
+
console.warn((_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
this._listeners = [];
|
|
237
|
+
}
|
|
238
|
+
if (Emitter.ENABLE_TRACKING && this._event) {
|
|
239
|
+
Emitter.MEMORY_LEAK_WATCHER.delete(this._event);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
181
242
|
}
|
|
182
243
|
}
|
|
244
|
+
Emitter.ENABLE_TRACKING = false;
|
|
245
|
+
Emitter.MEMORY_LEAK_WATCHER = new LeakageMonitor();
|
|
183
246
|
function addDisposableWindowListener(element, type, listener, options) {
|
|
184
247
|
element.addEventListener(type, listener, options);
|
|
185
248
|
return {
|
|
@@ -232,13 +295,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
232
295
|
}
|
|
233
296
|
constructor(...args) {
|
|
234
297
|
this._isDisposed = false;
|
|
235
|
-
this.
|
|
298
|
+
this._disposables = args;
|
|
236
299
|
}
|
|
237
300
|
addDisposables(...args) {
|
|
238
|
-
args.forEach((arg) => this.
|
|
301
|
+
args.forEach((arg) => this._disposables.push(arg));
|
|
239
302
|
}
|
|
240
303
|
dispose() {
|
|
241
|
-
this.
|
|
304
|
+
this._disposables.forEach((arg) => arg.dispose());
|
|
242
305
|
this._isDisposed = true;
|
|
243
306
|
}
|
|
244
307
|
}
|
|
@@ -328,6 +391,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
328
391
|
this.onDidFocus = this._onDidFocus.event;
|
|
329
392
|
this._onDidBlur = new Emitter();
|
|
330
393
|
this.onDidBlur = this._onDidBlur.event;
|
|
394
|
+
this.addDisposables(this._onDidFocus, this._onDidBlur);
|
|
331
395
|
let hasFocus = isAncestor(document.activeElement, element);
|
|
332
396
|
let loosingFocus = false;
|
|
333
397
|
const onFocus = () => {
|
|
@@ -372,11 +436,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
372
436
|
refreshState() {
|
|
373
437
|
this._refreshStateHandler();
|
|
374
438
|
}
|
|
375
|
-
dispose() {
|
|
376
|
-
super.dispose();
|
|
377
|
-
this._onDidBlur.dispose();
|
|
378
|
-
this._onDidFocus.dispose();
|
|
379
|
-
}
|
|
380
439
|
}
|
|
381
440
|
|
|
382
441
|
function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
|
|
@@ -605,7 +664,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
605
664
|
this._orthogonalSize = value;
|
|
606
665
|
}
|
|
607
666
|
get length() {
|
|
608
|
-
return this.
|
|
667
|
+
return this.viewItems.length;
|
|
609
668
|
}
|
|
610
669
|
get proportions() {
|
|
611
670
|
return this._proportions ? [...this._proportions] : undefined;
|
|
@@ -624,12 +683,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
624
683
|
: 'vertical');
|
|
625
684
|
}
|
|
626
685
|
get minimumSize() {
|
|
627
|
-
return this.
|
|
686
|
+
return this.viewItems.reduce((r, item) => r + item.minimumSize, 0);
|
|
628
687
|
}
|
|
629
688
|
get maximumSize() {
|
|
630
689
|
return this.length === 0
|
|
631
690
|
? Number.POSITIVE_INFINITY
|
|
632
|
-
: this.
|
|
691
|
+
: this.viewItems.reduce((r, item) => r + item.maximumSize, 0);
|
|
633
692
|
}
|
|
634
693
|
get startSnappingEnabled() {
|
|
635
694
|
return this._startSnappingEnabled;
|
|
@@ -653,7 +712,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
653
712
|
}
|
|
654
713
|
constructor(container, options) {
|
|
655
714
|
this.container = container;
|
|
656
|
-
this.
|
|
715
|
+
this.viewItems = [];
|
|
657
716
|
this.sashes = [];
|
|
658
717
|
this._size = 0;
|
|
659
718
|
this._orthogonalSize = 0;
|
|
@@ -667,12 +726,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
667
726
|
this.onDidAddView = this._onDidAddView.event;
|
|
668
727
|
this._onDidRemoveView = new Emitter();
|
|
669
728
|
this.onDidRemoveView = this._onDidRemoveView.event;
|
|
670
|
-
this.resize = (index, delta, sizes = this.
|
|
671
|
-
if (index < 0 || index > this.
|
|
729
|
+
this.resize = (index, delta, sizes = this.viewItems.map((x) => x.size), lowPriorityIndexes, highPriorityIndexes, overloadMinDelta = Number.NEGATIVE_INFINITY, overloadMaxDelta = Number.POSITIVE_INFINITY, snapBefore, snapAfter) => {
|
|
730
|
+
if (index < 0 || index > this.viewItems.length) {
|
|
672
731
|
return 0;
|
|
673
732
|
}
|
|
674
733
|
const upIndexes = range(index, -1);
|
|
675
|
-
const downIndexes = range(index + 1, this.
|
|
734
|
+
const downIndexes = range(index + 1, this.viewItems.length);
|
|
676
735
|
//
|
|
677
736
|
if (highPriorityIndexes) {
|
|
678
737
|
for (const i of highPriorityIndexes) {
|
|
@@ -687,34 +746,34 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
687
746
|
}
|
|
688
747
|
}
|
|
689
748
|
//
|
|
690
|
-
const upItems = upIndexes.map((i) => this.
|
|
749
|
+
const upItems = upIndexes.map((i) => this.viewItems[i]);
|
|
691
750
|
const upSizes = upIndexes.map((i) => sizes[i]);
|
|
692
751
|
//
|
|
693
|
-
const downItems = downIndexes.map((i) => this.
|
|
752
|
+
const downItems = downIndexes.map((i) => this.viewItems[i]);
|
|
694
753
|
const downSizes = downIndexes.map((i) => sizes[i]);
|
|
695
754
|
//
|
|
696
|
-
const minDeltaUp = upIndexes.reduce((_, i) => _ + this.
|
|
697
|
-
const maxDeltaUp = upIndexes.reduce((_, i) => _ + this.
|
|
755
|
+
const minDeltaUp = upIndexes.reduce((_, i) => _ + this.viewItems[i].minimumSize - sizes[i], 0);
|
|
756
|
+
const maxDeltaUp = upIndexes.reduce((_, i) => _ + this.viewItems[i].maximumSize - sizes[i], 0);
|
|
698
757
|
//
|
|
699
758
|
const maxDeltaDown = downIndexes.length === 0
|
|
700
759
|
? Number.POSITIVE_INFINITY
|
|
701
|
-
: downIndexes.reduce((_, i) => _ + sizes[i] - this.
|
|
760
|
+
: downIndexes.reduce((_, i) => _ + sizes[i] - this.viewItems[i].minimumSize, 0);
|
|
702
761
|
const minDeltaDown = downIndexes.length === 0
|
|
703
762
|
? Number.NEGATIVE_INFINITY
|
|
704
|
-
: downIndexes.reduce((_, i) => _ + sizes[i] - this.
|
|
763
|
+
: downIndexes.reduce((_, i) => _ + sizes[i] - this.viewItems[i].maximumSize, 0);
|
|
705
764
|
//
|
|
706
765
|
const minDelta = Math.max(minDeltaUp, minDeltaDown);
|
|
707
766
|
const maxDelta = Math.min(maxDeltaDown, maxDeltaUp);
|
|
708
767
|
//
|
|
709
768
|
let snapped = false;
|
|
710
769
|
if (snapBefore) {
|
|
711
|
-
const snapView = this.
|
|
770
|
+
const snapView = this.viewItems[snapBefore.index];
|
|
712
771
|
const visible = delta >= snapBefore.limitDelta;
|
|
713
772
|
snapped = visible !== snapView.visible;
|
|
714
773
|
snapView.setVisible(visible, snapBefore.size);
|
|
715
774
|
}
|
|
716
775
|
if (!snapped && snapAfter) {
|
|
717
|
-
const snapView = this.
|
|
776
|
+
const snapView = this.viewItems[snapAfter.index];
|
|
718
777
|
const visible = delta < snapAfter.limitDelta;
|
|
719
778
|
snapped = visible !== snapView.visible;
|
|
720
779
|
snapView.setVisible(visible, snapAfter.size);
|
|
@@ -776,7 +835,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
776
835
|
);
|
|
777
836
|
});
|
|
778
837
|
// Initialize content size and proportions for first layout
|
|
779
|
-
this.contentSize = this.
|
|
838
|
+
this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
780
839
|
this.saveProportions();
|
|
781
840
|
}
|
|
782
841
|
}
|
|
@@ -793,18 +852,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
793
852
|
}
|
|
794
853
|
}
|
|
795
854
|
isViewVisible(index) {
|
|
796
|
-
if (index < 0 || index >= this.
|
|
855
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
797
856
|
throw new Error('Index out of bounds');
|
|
798
857
|
}
|
|
799
|
-
const viewItem = this.
|
|
858
|
+
const viewItem = this.viewItems[index];
|
|
800
859
|
return viewItem.visible;
|
|
801
860
|
}
|
|
802
861
|
setViewVisible(index, visible) {
|
|
803
|
-
if (index < 0 || index >= this.
|
|
862
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
804
863
|
throw new Error('Index out of bounds');
|
|
805
864
|
}
|
|
806
865
|
toggleClass(this.container, 'visible', visible);
|
|
807
|
-
const viewItem = this.
|
|
866
|
+
const viewItem = this.viewItems[index];
|
|
808
867
|
toggleClass(this.container, 'visible', visible);
|
|
809
868
|
viewItem.setVisible(visible, viewItem.size);
|
|
810
869
|
this.distributeEmptySpace(index);
|
|
@@ -812,33 +871,33 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
812
871
|
this.saveProportions();
|
|
813
872
|
}
|
|
814
873
|
getViewSize(index) {
|
|
815
|
-
if (index < 0 || index >= this.
|
|
874
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
816
875
|
return -1;
|
|
817
876
|
}
|
|
818
|
-
return this.
|
|
877
|
+
return this.viewItems[index].size;
|
|
819
878
|
}
|
|
820
879
|
resizeView(index, size) {
|
|
821
|
-
if (index < 0 || index >= this.
|
|
880
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
822
881
|
return;
|
|
823
882
|
}
|
|
824
|
-
const indexes = range(this.
|
|
883
|
+
const indexes = range(this.viewItems.length).filter((i) => i !== index);
|
|
825
884
|
const lowPriorityIndexes = [
|
|
826
|
-
...indexes.filter((i) => this.
|
|
885
|
+
...indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low),
|
|
827
886
|
index,
|
|
828
887
|
];
|
|
829
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
830
|
-
const item = this.
|
|
888
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
889
|
+
const item = this.viewItems[index];
|
|
831
890
|
size = Math.round(size);
|
|
832
891
|
size = clamp(size, item.minimumSize, Math.min(item.maximumSize, this._size));
|
|
833
892
|
item.size = size;
|
|
834
893
|
this.relayout(lowPriorityIndexes, highPriorityIndexes);
|
|
835
894
|
}
|
|
836
895
|
getViews() {
|
|
837
|
-
return this.
|
|
896
|
+
return this.viewItems.map((x) => x.view);
|
|
838
897
|
}
|
|
839
898
|
onDidChange(item, size) {
|
|
840
|
-
const index = this.
|
|
841
|
-
if (index < 0 || index >= this.
|
|
899
|
+
const index = this.viewItems.indexOf(item);
|
|
900
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
842
901
|
return;
|
|
843
902
|
}
|
|
844
903
|
size = typeof size === 'number' ? size : item.size;
|
|
@@ -846,7 +905,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
846
905
|
item.size = size;
|
|
847
906
|
this.relayout([index]);
|
|
848
907
|
}
|
|
849
|
-
addView(view, size = { type: 'distribute' }, index = this.
|
|
908
|
+
addView(view, size = { type: 'distribute' }, index = this.viewItems.length, skipLayout) {
|
|
850
909
|
const container = document.createElement('div');
|
|
851
910
|
container.className = 'view';
|
|
852
911
|
container.appendChild(view.element);
|
|
@@ -864,24 +923,25 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
864
923
|
viewSize = view.minimumSize;
|
|
865
924
|
}
|
|
866
925
|
const disposable = view.onDidChange((newSize) => this.onDidChange(viewItem, newSize.size));
|
|
867
|
-
const
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
926
|
+
const viewItem = new ViewItem(container, view, viewSize, {
|
|
927
|
+
dispose: () => {
|
|
928
|
+
disposable.dispose();
|
|
929
|
+
this.viewContainer.removeChild(container);
|
|
930
|
+
},
|
|
931
|
+
});
|
|
932
|
+
if (index === this.viewItems.length) {
|
|
873
933
|
this.viewContainer.appendChild(container);
|
|
874
934
|
}
|
|
875
935
|
else {
|
|
876
936
|
this.viewContainer.insertBefore(container, this.viewContainer.children.item(index));
|
|
877
937
|
}
|
|
878
|
-
this.
|
|
879
|
-
if (this.
|
|
938
|
+
this.viewItems.splice(index, 0, viewItem);
|
|
939
|
+
if (this.viewItems.length > 1) {
|
|
880
940
|
//add sash
|
|
881
941
|
const sash = document.createElement('div');
|
|
882
942
|
sash.className = 'sash';
|
|
883
943
|
const onStart = (event) => {
|
|
884
|
-
for (const item of this.
|
|
944
|
+
for (const item of this.viewItems) {
|
|
885
945
|
item.enabled = false;
|
|
886
946
|
}
|
|
887
947
|
const iframes = [
|
|
@@ -896,27 +956,29 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
896
956
|
: event.clientY;
|
|
897
957
|
const sashIndex = firstIndex(this.sashes, (s) => s.container === sash);
|
|
898
958
|
//
|
|
899
|
-
const sizes = this.
|
|
959
|
+
const sizes = this.viewItems.map((x) => x.size);
|
|
900
960
|
//
|
|
901
961
|
let snapBefore;
|
|
902
962
|
let snapAfter;
|
|
903
963
|
const upIndexes = range(sashIndex, -1);
|
|
904
|
-
const downIndexes = range(sashIndex + 1, this.
|
|
905
|
-
const minDeltaUp = upIndexes.reduce((r, i) => r + (this.
|
|
906
|
-
const maxDeltaUp = upIndexes.reduce((r, i) => r + (this.
|
|
964
|
+
const downIndexes = range(sashIndex + 1, this.viewItems.length);
|
|
965
|
+
const minDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].minimumSize - sizes[i]), 0);
|
|
966
|
+
const maxDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].viewMaximumSize - sizes[i]), 0);
|
|
907
967
|
const maxDeltaDown = downIndexes.length === 0
|
|
908
968
|
? Number.POSITIVE_INFINITY
|
|
909
|
-
: downIndexes.reduce((r, i) => r +
|
|
969
|
+
: downIndexes.reduce((r, i) => r +
|
|
970
|
+
(sizes[i] - this.viewItems[i].minimumSize), 0);
|
|
910
971
|
const minDeltaDown = downIndexes.length === 0
|
|
911
972
|
? Number.NEGATIVE_INFINITY
|
|
912
973
|
: downIndexes.reduce((r, i) => r +
|
|
913
|
-
(sizes[i] -
|
|
974
|
+
(sizes[i] -
|
|
975
|
+
this.viewItems[i].viewMaximumSize), 0);
|
|
914
976
|
const minDelta = Math.max(minDeltaUp, minDeltaDown);
|
|
915
977
|
const maxDelta = Math.min(maxDeltaDown, maxDeltaUp);
|
|
916
978
|
const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);
|
|
917
979
|
const snapAfterIndex = this.findFirstSnapIndex(downIndexes);
|
|
918
980
|
if (typeof snapBeforeIndex === 'number') {
|
|
919
|
-
const snappedViewItem = this.
|
|
981
|
+
const snappedViewItem = this.viewItems[snapBeforeIndex];
|
|
920
982
|
const halfSize = Math.floor(snappedViewItem.viewMinimumSize / 2);
|
|
921
983
|
snapBefore = {
|
|
922
984
|
index: snapBeforeIndex,
|
|
@@ -927,7 +989,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
927
989
|
};
|
|
928
990
|
}
|
|
929
991
|
if (typeof snapAfterIndex === 'number') {
|
|
930
|
-
const snappedViewItem = this.
|
|
992
|
+
const snappedViewItem = this.viewItems[snapAfterIndex];
|
|
931
993
|
const halfSize = Math.floor(snappedViewItem.viewMinimumSize / 2);
|
|
932
994
|
snapAfter = {
|
|
933
995
|
index: snapAfterIndex,
|
|
@@ -948,7 +1010,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
948
1010
|
this.layoutViews();
|
|
949
1011
|
};
|
|
950
1012
|
const end = () => {
|
|
951
|
-
for (const item of this.
|
|
1013
|
+
for (const item of this.viewItems) {
|
|
952
1014
|
item.enabled = true;
|
|
953
1015
|
}
|
|
954
1016
|
for (const iframe of iframes) {
|
|
@@ -988,7 +1050,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
988
1050
|
distributeViewSizes() {
|
|
989
1051
|
const flexibleViewItems = [];
|
|
990
1052
|
let flexibleSize = 0;
|
|
991
|
-
for (const item of this.
|
|
1053
|
+
for (const item of this.viewItems) {
|
|
992
1054
|
if (item.maximumSize - item.minimumSize > 0) {
|
|
993
1055
|
flexibleViewItems.push(item);
|
|
994
1056
|
flexibleSize += item.size;
|
|
@@ -998,17 +1060,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
998
1060
|
for (const item of flexibleViewItems) {
|
|
999
1061
|
item.size = clamp(size, item.minimumSize, item.maximumSize);
|
|
1000
1062
|
}
|
|
1001
|
-
const indexes = range(this.
|
|
1002
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
1003
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1063
|
+
const indexes = range(this.viewItems.length);
|
|
1064
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1065
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1004
1066
|
this.relayout(lowPriorityIndexes, highPriorityIndexes);
|
|
1005
1067
|
}
|
|
1006
1068
|
removeView(index, sizing, skipLayout = false) {
|
|
1007
1069
|
// Remove view
|
|
1008
|
-
const viewItem = this.
|
|
1070
|
+
const viewItem = this.viewItems.splice(index, 1)[0];
|
|
1009
1071
|
viewItem.dispose();
|
|
1010
1072
|
// Remove sash
|
|
1011
|
-
if (this.
|
|
1073
|
+
if (this.viewItems.length >= 1) {
|
|
1012
1074
|
const sashIndex = Math.max(index - 1, 0);
|
|
1013
1075
|
const sashItem = this.sashes.splice(sashIndex, 1)[0];
|
|
1014
1076
|
sashItem.disposable();
|
|
@@ -1023,10 +1085,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1023
1085
|
return viewItem.view;
|
|
1024
1086
|
}
|
|
1025
1087
|
getViewCachedVisibleSize(index) {
|
|
1026
|
-
if (index < 0 || index >= this.
|
|
1088
|
+
if (index < 0 || index >= this.viewItems.length) {
|
|
1027
1089
|
throw new Error('Index out of bounds');
|
|
1028
1090
|
}
|
|
1029
|
-
const viewItem = this.
|
|
1091
|
+
const viewItem = this.viewItems[index];
|
|
1030
1092
|
return viewItem.cachedVisibleSize;
|
|
1031
1093
|
}
|
|
1032
1094
|
moveView(from, to) {
|
|
@@ -1042,14 +1104,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1042
1104
|
this.size = size;
|
|
1043
1105
|
this.orthogonalSize = orthogonalSize;
|
|
1044
1106
|
if (!this.proportions) {
|
|
1045
|
-
const indexes = range(this.
|
|
1046
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
1047
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1048
|
-
this.resize(this.
|
|
1107
|
+
const indexes = range(this.viewItems.length);
|
|
1108
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1109
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1110
|
+
this.resize(this.viewItems.length - 1, size - previousSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
1049
1111
|
}
|
|
1050
1112
|
else {
|
|
1051
|
-
for (let i = 0; i < this.
|
|
1052
|
-
const item = this.
|
|
1113
|
+
for (let i = 0; i < this.viewItems.length; i++) {
|
|
1114
|
+
const item = this.viewItems[i];
|
|
1053
1115
|
item.size = clamp(Math.round(this.proportions[i] * size), item.minimumSize, item.maximumSize);
|
|
1054
1116
|
}
|
|
1055
1117
|
}
|
|
@@ -1057,18 +1119,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1057
1119
|
this.layoutViews();
|
|
1058
1120
|
}
|
|
1059
1121
|
relayout(lowPriorityIndexes, highPriorityIndexes) {
|
|
1060
|
-
const contentSize = this.
|
|
1061
|
-
this.resize(this.
|
|
1122
|
+
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1123
|
+
this.resize(this.viewItems.length - 1, this._size - contentSize, undefined, lowPriorityIndexes, highPriorityIndexes);
|
|
1062
1124
|
this.distributeEmptySpace();
|
|
1063
1125
|
this.layoutViews();
|
|
1064
1126
|
this.saveProportions();
|
|
1065
1127
|
}
|
|
1066
1128
|
distributeEmptySpace(lowPriorityIndex) {
|
|
1067
|
-
const contentSize = this.
|
|
1129
|
+
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1068
1130
|
let emptyDelta = this.size - contentSize;
|
|
1069
|
-
const indexes = range(this.
|
|
1070
|
-
const lowPriorityIndexes = indexes.filter((i) => this.
|
|
1071
|
-
const highPriorityIndexes = indexes.filter((i) => this.
|
|
1131
|
+
const indexes = range(this.viewItems.length - 1, -1);
|
|
1132
|
+
const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.Low);
|
|
1133
|
+
const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === exports.LayoutPriority.High);
|
|
1072
1134
|
for (const index of highPriorityIndexes) {
|
|
1073
1135
|
pushToStart(indexes, index);
|
|
1074
1136
|
}
|
|
@@ -1079,7 +1141,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1079
1141
|
pushToEnd(indexes, lowPriorityIndex);
|
|
1080
1142
|
}
|
|
1081
1143
|
for (let i = 0; emptyDelta !== 0 && i < indexes.length; i++) {
|
|
1082
|
-
const item = this.
|
|
1144
|
+
const item = this.viewItems[indexes[i]];
|
|
1083
1145
|
const size = clamp(item.size + emptyDelta, item.minimumSize, item.maximumSize);
|
|
1084
1146
|
const viewDelta = size - item.size;
|
|
1085
1147
|
emptyDelta -= viewDelta;
|
|
@@ -1088,16 +1150,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1088
1150
|
}
|
|
1089
1151
|
saveProportions() {
|
|
1090
1152
|
if (this.proportionalLayout && this.contentSize > 0) {
|
|
1091
|
-
this._proportions = this.
|
|
1153
|
+
this._proportions = this.viewItems.map((i) => i.size / this.contentSize);
|
|
1092
1154
|
}
|
|
1093
1155
|
}
|
|
1094
1156
|
layoutViews() {
|
|
1095
|
-
this.contentSize = this.
|
|
1157
|
+
this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
|
1096
1158
|
let sum = 0;
|
|
1097
1159
|
const x = [];
|
|
1098
1160
|
this.updateSashEnablement();
|
|
1099
|
-
for (let i = 0; i < this.
|
|
1100
|
-
sum += this.
|
|
1161
|
+
for (let i = 0; i < this.viewItems.length - 1; i++) {
|
|
1162
|
+
sum += this.viewItems[i].size;
|
|
1101
1163
|
x.push(sum);
|
|
1102
1164
|
const offset = Math.min(Math.max(0, sum - 2), this.size - 4);
|
|
1103
1165
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
@@ -1109,7 +1171,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1109
1171
|
this.sashes[i].container.style.top = `${offset}px`;
|
|
1110
1172
|
}
|
|
1111
1173
|
}
|
|
1112
|
-
this.
|
|
1174
|
+
this.viewItems.forEach((view, i) => {
|
|
1113
1175
|
if (this._orientation === exports.Orientation.HORIZONTAL) {
|
|
1114
1176
|
view.container.style.width = `${view.size}px`;
|
|
1115
1177
|
view.container.style.left = i == 0 ? '0px' : `${x[i - 1]}px`;
|
|
@@ -1128,7 +1190,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1128
1190
|
findFirstSnapIndex(indexes) {
|
|
1129
1191
|
// visible views first
|
|
1130
1192
|
for (const index of indexes) {
|
|
1131
|
-
const viewItem = this.
|
|
1193
|
+
const viewItem = this.viewItems[index];
|
|
1132
1194
|
if (!viewItem.visible) {
|
|
1133
1195
|
continue;
|
|
1134
1196
|
}
|
|
@@ -1138,7 +1200,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1138
1200
|
}
|
|
1139
1201
|
// then, hidden views
|
|
1140
1202
|
for (const index of indexes) {
|
|
1141
|
-
const viewItem = this.
|
|
1203
|
+
const viewItem = this.viewItems[index];
|
|
1142
1204
|
if (viewItem.visible &&
|
|
1143
1205
|
viewItem.maximumSize - viewItem.minimumSize > 0) {
|
|
1144
1206
|
return undefined;
|
|
@@ -1151,10 +1213,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1151
1213
|
}
|
|
1152
1214
|
updateSashEnablement() {
|
|
1153
1215
|
let previous = false;
|
|
1154
|
-
const collapsesDown = this.
|
|
1216
|
+
const collapsesDown = this.viewItems.map((i) => (previous = i.size - i.minimumSize > 0 || previous));
|
|
1155
1217
|
previous = false;
|
|
1156
|
-
const expandsDown = this.
|
|
1157
|
-
const reverseViews = [...this.
|
|
1218
|
+
const expandsDown = this.viewItems.map((i) => (previous = i.maximumSize - i.size > 0 || previous));
|
|
1219
|
+
const reverseViews = [...this.viewItems].reverse();
|
|
1158
1220
|
previous = false;
|
|
1159
1221
|
const collapsesUp = reverseViews
|
|
1160
1222
|
.map((i) => (previous = i.size - i.minimumSize > 0 || previous))
|
|
@@ -1166,19 +1228,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1166
1228
|
let position = 0;
|
|
1167
1229
|
for (let index = 0; index < this.sashes.length; index++) {
|
|
1168
1230
|
const sash = this.sashes[index];
|
|
1169
|
-
const viewItem = this.
|
|
1231
|
+
const viewItem = this.viewItems[index];
|
|
1170
1232
|
position += viewItem.size;
|
|
1171
1233
|
const min = !(collapsesDown[index] && expandsUp[index + 1]);
|
|
1172
1234
|
const max = !(expandsDown[index] && collapsesUp[index + 1]);
|
|
1173
1235
|
if (min && max) {
|
|
1174
1236
|
const upIndexes = range(index, -1);
|
|
1175
|
-
const downIndexes = range(index + 1, this.
|
|
1237
|
+
const downIndexes = range(index + 1, this.viewItems.length);
|
|
1176
1238
|
const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);
|
|
1177
1239
|
const snapAfterIndex = this.findFirstSnapIndex(downIndexes);
|
|
1178
1240
|
const snappedBefore = typeof snapBeforeIndex === 'number' &&
|
|
1179
|
-
!this.
|
|
1241
|
+
!this.viewItems[snapBeforeIndex].visible;
|
|
1180
1242
|
const snappedAfter = typeof snapAfterIndex === 'number' &&
|
|
1181
|
-
!this.
|
|
1243
|
+
!this.viewItems[snapAfterIndex].visible;
|
|
1182
1244
|
if (snappedBefore &&
|
|
1183
1245
|
collapsesUp[index] &&
|
|
1184
1246
|
(position > 0 || this.startSnappingEnabled)) {
|
|
@@ -1238,6 +1300,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1238
1300
|
break;
|
|
1239
1301
|
}
|
|
1240
1302
|
}
|
|
1303
|
+
for (const viewItem of this.viewItems) {
|
|
1304
|
+
viewItem.dispose();
|
|
1305
|
+
}
|
|
1241
1306
|
this.element.remove();
|
|
1242
1307
|
}
|
|
1243
1308
|
}
|
|
@@ -1672,7 +1737,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1672
1737
|
throw new Error('Invalid index');
|
|
1673
1738
|
}
|
|
1674
1739
|
this.splitview.removeView(index, sizing);
|
|
1675
|
-
this._removeChild(index);
|
|
1740
|
+
return this._removeChild(index);
|
|
1676
1741
|
}
|
|
1677
1742
|
_addChild(node, index) {
|
|
1678
1743
|
this.children.splice(index, 0, node);
|
|
@@ -1694,10 +1759,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1694
1759
|
});
|
|
1695
1760
|
}
|
|
1696
1761
|
dispose() {
|
|
1697
|
-
super.dispose();
|
|
1698
1762
|
this._childrenDisposable.dispose();
|
|
1699
|
-
this.children.forEach((child) => child.dispose());
|
|
1700
1763
|
this.splitview.dispose();
|
|
1764
|
+
this.children.forEach((child) => child.dispose());
|
|
1765
|
+
super.dispose();
|
|
1701
1766
|
}
|
|
1702
1767
|
}
|
|
1703
1768
|
|
|
@@ -1927,7 +1992,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1927
1992
|
if (oldRoot.children.length === 1) {
|
|
1928
1993
|
// can remove one level of redundant branching if there is only a single child
|
|
1929
1994
|
const childReference = oldRoot.children[0];
|
|
1930
|
-
oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
1995
|
+
const child = oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
|
|
1996
|
+
child.dispose();
|
|
1931
1997
|
oldRoot.dispose();
|
|
1932
1998
|
this._root.addChild(
|
|
1933
1999
|
/**
|
|
@@ -2034,7 +2100,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2034
2100
|
if (typeof newSiblingCachedVisibleSize === 'number') {
|
|
2035
2101
|
newSiblingSize = exports.Sizing.Invisible(newSiblingCachedVisibleSize);
|
|
2036
2102
|
}
|
|
2037
|
-
grandParent.removeChild(parentIndex);
|
|
2103
|
+
const child = grandParent.removeChild(parentIndex);
|
|
2104
|
+
child.dispose();
|
|
2038
2105
|
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize);
|
|
2039
2106
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
2040
2107
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
@@ -2060,30 +2127,36 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2060
2127
|
if (!(node instanceof LeafNode)) {
|
|
2061
2128
|
throw new Error('Invalid location');
|
|
2062
2129
|
}
|
|
2063
|
-
|
|
2130
|
+
const view = node.view;
|
|
2131
|
+
node.dispose(); // dispose of node
|
|
2132
|
+
const child = parent.removeChild(index, sizing);
|
|
2133
|
+
child.dispose();
|
|
2064
2134
|
if (parent.children.length === 0) {
|
|
2065
|
-
return
|
|
2135
|
+
return view;
|
|
2066
2136
|
}
|
|
2067
2137
|
if (parent.children.length > 1) {
|
|
2068
|
-
return
|
|
2138
|
+
return view;
|
|
2069
2139
|
}
|
|
2070
2140
|
const sibling = parent.children[0];
|
|
2071
2141
|
if (pathToParent.length === 0) {
|
|
2072
2142
|
// parent is root
|
|
2073
2143
|
if (sibling instanceof LeafNode) {
|
|
2074
|
-
return
|
|
2144
|
+
return view;
|
|
2075
2145
|
}
|
|
2076
2146
|
// we must promote sibling to be the new root
|
|
2077
|
-
parent.removeChild(0, sizing);
|
|
2147
|
+
const child = parent.removeChild(0, sizing);
|
|
2148
|
+
child.dispose();
|
|
2078
2149
|
this.root = sibling;
|
|
2079
|
-
return
|
|
2150
|
+
return view;
|
|
2080
2151
|
}
|
|
2081
2152
|
const [grandParent, ..._] = [...pathToParent].reverse();
|
|
2082
2153
|
const [parentIndex, ...__] = [...rest].reverse();
|
|
2083
2154
|
const isSiblingVisible = parent.isChildVisible(0);
|
|
2084
|
-
parent.removeChild(0, sizing);
|
|
2155
|
+
const childNode = parent.removeChild(0, sizing);
|
|
2156
|
+
childNode.dispose();
|
|
2085
2157
|
const sizes = grandParent.children.map((_size, i) => grandParent.getChildSize(i));
|
|
2086
|
-
grandParent.removeChild(parentIndex, sizing);
|
|
2158
|
+
const parentNode = grandParent.removeChild(parentIndex, sizing);
|
|
2159
|
+
parentNode.dispose();
|
|
2087
2160
|
if (sibling instanceof BranchNode) {
|
|
2088
2161
|
sizes.splice(parentIndex, 1, ...sibling.children.map((c) => c.size));
|
|
2089
2162
|
for (let i = 0; i < sibling.children.length; i++) {
|
|
@@ -2101,7 +2174,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2101
2174
|
for (let i = 0; i < sizes.length; i++) {
|
|
2102
2175
|
grandParent.resizeChild(i, sizes[i]);
|
|
2103
2176
|
}
|
|
2104
|
-
return
|
|
2177
|
+
return view;
|
|
2105
2178
|
}
|
|
2106
2179
|
layout(width, height) {
|
|
2107
2180
|
const [size, orthogonalSize] = this.root.orientation === exports.Orientation.HORIZONTAL
|
|
@@ -2596,6 +2669,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2596
2669
|
}
|
|
2597
2670
|
dispose() {
|
|
2598
2671
|
this.removeDropTarget();
|
|
2672
|
+
super.dispose();
|
|
2599
2673
|
}
|
|
2600
2674
|
toggleClasses(quadrant, width, height) {
|
|
2601
2675
|
var _a, _b, _c, _d;
|
|
@@ -2773,8 +2847,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2773
2847
|
if (this.panel.view) {
|
|
2774
2848
|
const _onDidFocus = this.panel.view.content.onDidFocus;
|
|
2775
2849
|
const _onDidBlur = this.panel.view.content.onDidBlur;
|
|
2776
|
-
const
|
|
2777
|
-
disposable.addDisposables(onDidFocus(() => this._onDidFocus.fire()), onDidBlur(() => this._onDidBlur.fire()));
|
|
2850
|
+
const focusTracker = trackFocus(this._element);
|
|
2851
|
+
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
|
|
2778
2852
|
if (_onDidFocus) {
|
|
2779
2853
|
disposable.addDisposables(_onDidFocus(() => this._onDidFocus.fire()));
|
|
2780
2854
|
}
|
|
@@ -2817,6 +2891,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2817
2891
|
this._onDragStart = new Emitter();
|
|
2818
2892
|
this.onDragStart = this._onDragStart.event;
|
|
2819
2893
|
this.iframes = [];
|
|
2894
|
+
this.addDisposables(this._onDragStart);
|
|
2820
2895
|
this.configure();
|
|
2821
2896
|
}
|
|
2822
2897
|
configure() {
|
|
@@ -2867,13 +2942,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2867
2942
|
this.onChanged = this._onChanged.event;
|
|
2868
2943
|
this._onDropped = new Emitter();
|
|
2869
2944
|
this.onDrop = this._onDropped.event;
|
|
2870
|
-
this.addDisposables(this._onChanged, this._onDropped);
|
|
2871
2945
|
this._element = document.createElement('div');
|
|
2872
2946
|
this._element.className = 'tab';
|
|
2873
2947
|
this._element.tabIndex = 0;
|
|
2874
2948
|
this._element.draggable = true;
|
|
2875
2949
|
toggleClass(this.element, 'inactive-tab', true);
|
|
2876
|
-
this.addDisposables(new (class Handler extends DragHandler {
|
|
2950
|
+
this.addDisposables(this._onChanged, this._onDropped, new (class Handler extends DragHandler {
|
|
2877
2951
|
constructor() {
|
|
2878
2952
|
super(...arguments);
|
|
2879
2953
|
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
@@ -2886,9 +2960,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2886
2960
|
},
|
|
2887
2961
|
};
|
|
2888
2962
|
}
|
|
2889
|
-
dispose() {
|
|
2890
|
-
//
|
|
2891
|
-
}
|
|
2892
2963
|
})(this._element));
|
|
2893
2964
|
this.addDisposables(addDisposableListener(this._element, 'mousedown', (event) => {
|
|
2894
2965
|
if (event.defaultPrevented) {
|
|
@@ -2923,7 +2994,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2923
2994
|
});
|
|
2924
2995
|
this.addDisposables(this.droptarget.onDrop((event) => {
|
|
2925
2996
|
this._onDropped.fire(event);
|
|
2926
|
-
}));
|
|
2997
|
+
}), this.droptarget);
|
|
2927
2998
|
}
|
|
2928
2999
|
setActive(isActive) {
|
|
2929
3000
|
toggleClass(this.element, 'active-tab', isActive);
|
|
@@ -2938,7 +3009,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2938
3009
|
}
|
|
2939
3010
|
dispose() {
|
|
2940
3011
|
super.dispose();
|
|
2941
|
-
this.droptarget.dispose();
|
|
2942
3012
|
}
|
|
2943
3013
|
}
|
|
2944
3014
|
|
|
@@ -2984,9 +3054,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2984
3054
|
},
|
|
2985
3055
|
};
|
|
2986
3056
|
}
|
|
2987
|
-
dispose() {
|
|
2988
|
-
//
|
|
2989
|
-
}
|
|
2990
3057
|
}
|
|
2991
3058
|
|
|
2992
3059
|
class VoidContainer extends CompositeDisposable {
|
|
@@ -3142,6 +3209,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3142
3209
|
const tabToRemove = this.tabs.splice(index, 1)[0];
|
|
3143
3210
|
const { value, disposable } = tabToRemove;
|
|
3144
3211
|
disposable.dispose();
|
|
3212
|
+
value.dispose();
|
|
3145
3213
|
value.element.remove();
|
|
3146
3214
|
}
|
|
3147
3215
|
setActivePanel(panel) {
|
|
@@ -3185,9 +3253,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3185
3253
|
}
|
|
3186
3254
|
dispose() {
|
|
3187
3255
|
super.dispose();
|
|
3188
|
-
this.tabs
|
|
3189
|
-
|
|
3190
|
-
|
|
3256
|
+
for (const { value, disposable } of this.tabs) {
|
|
3257
|
+
disposable.dispose();
|
|
3258
|
+
value.dispose();
|
|
3259
|
+
}
|
|
3191
3260
|
this.tabs = [];
|
|
3192
3261
|
}
|
|
3193
3262
|
}
|
|
@@ -3285,7 +3354,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3285
3354
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
3286
3355
|
this.header.hidden = !!options.hideHeader;
|
|
3287
3356
|
this.locked = !!options.locked;
|
|
3288
|
-
this.addDisposables(this.
|
|
3357
|
+
this.addDisposables(this.tabsContainer.onDrop((event) => {
|
|
3289
3358
|
this.handleDropEvent(event.event, 'center', event.index);
|
|
3290
3359
|
}), this.contentContainer.onDidFocus(() => {
|
|
3291
3360
|
this.accessor.doSetGroupActive(this.groupPanel, true);
|
|
@@ -3293,7 +3362,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3293
3362
|
// noop
|
|
3294
3363
|
}), this.dropTarget.onDrop((event) => {
|
|
3295
3364
|
this.handleDropEvent(event.nativeEvent, event.position);
|
|
3296
|
-
}));
|
|
3365
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
3297
3366
|
}
|
|
3298
3367
|
initialize() {
|
|
3299
3368
|
var _a, _b;
|
|
@@ -3727,8 +3796,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3727
3796
|
this.layout(0, 0, true); // set some elements height/widths
|
|
3728
3797
|
this.addDisposables(this.gridview.onDidChange(() => {
|
|
3729
3798
|
this._bufferOnDidLayoutChange.fire();
|
|
3730
|
-
}))
|
|
3731
|
-
this.addDisposables(exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3799
|
+
}), exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3732
3800
|
this._bufferOnDidLayoutChange.fire();
|
|
3733
3801
|
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
3734
3802
|
this._onDidLayoutChange.fire();
|
|
@@ -3831,7 +3899,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3831
3899
|
this.gridview.layout(width, height);
|
|
3832
3900
|
}
|
|
3833
3901
|
dispose() {
|
|
3834
|
-
super.dispose();
|
|
3835
3902
|
this._onDidActiveGroupChange.dispose();
|
|
3836
3903
|
this._onDidAddGroup.dispose();
|
|
3837
3904
|
this._onDidRemoveGroup.dispose();
|
|
@@ -3840,6 +3907,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3840
3907
|
group.dispose();
|
|
3841
3908
|
}
|
|
3842
3909
|
this.gridview.dispose();
|
|
3910
|
+
super.dispose();
|
|
3843
3911
|
}
|
|
3844
3912
|
}
|
|
3845
3913
|
|
|
@@ -3903,7 +3971,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3903
3971
|
//
|
|
3904
3972
|
this._onUpdateParameters = new Emitter();
|
|
3905
3973
|
this.onUpdateParameters = this._onUpdateParameters.event;
|
|
3906
|
-
this.addDisposables(this.
|
|
3974
|
+
this.addDisposables(this.onDidFocusChange((event) => {
|
|
3907
3975
|
this._isFocused = event.isFocused;
|
|
3908
3976
|
}), this.onDidActiveChange((event) => {
|
|
3909
3977
|
this._isActive = event.isActive;
|
|
@@ -3912,14 +3980,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3912
3980
|
}), this.onDidDimensionsChange((event) => {
|
|
3913
3981
|
this._width = event.width;
|
|
3914
3982
|
this._height = event.height;
|
|
3915
|
-
}));
|
|
3983
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onFocusEvent, this._onActiveChange, this._onVisibilityChange, this._onUpdateParameters);
|
|
3916
3984
|
}
|
|
3917
3985
|
initialize(panel) {
|
|
3918
3986
|
this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
|
|
3919
3987
|
panel.update({
|
|
3920
|
-
params:
|
|
3921
|
-
params: parameters,
|
|
3922
|
-
},
|
|
3988
|
+
params: parameters,
|
|
3923
3989
|
});
|
|
3924
3990
|
});
|
|
3925
3991
|
}
|
|
@@ -4014,12 +4080,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4014
4080
|
this._element.style.height = '100%';
|
|
4015
4081
|
this._element.style.width = '100%';
|
|
4016
4082
|
this._element.style.overflow = 'hidden';
|
|
4017
|
-
const
|
|
4018
|
-
this.addDisposables(this.api, onDidFocus(() => {
|
|
4083
|
+
const focusTracker = trackFocus(this._element);
|
|
4084
|
+
this.addDisposables(this.api, focusTracker.onDidFocus(() => {
|
|
4019
4085
|
this.api._onDidChangeFocus.fire({ isFocused: true });
|
|
4020
|
-
}), onDidBlur(() => {
|
|
4086
|
+
}), focusTracker.onDidBlur(() => {
|
|
4021
4087
|
this.api._onDidChangeFocus.fire({ isFocused: false });
|
|
4022
|
-
}));
|
|
4088
|
+
}), focusTracker);
|
|
4023
4089
|
}
|
|
4024
4090
|
focus() {
|
|
4025
4091
|
this.api._onFocusEvent.fire();
|
|
@@ -4040,7 +4106,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4040
4106
|
}
|
|
4041
4107
|
update(event) {
|
|
4042
4108
|
var _a, _b;
|
|
4109
|
+
// merge the new parameters with the existing parameters
|
|
4043
4110
|
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) });
|
|
4111
|
+
/**
|
|
4112
|
+
* delete new keys that have a value of undefined,
|
|
4113
|
+
* allow values of null
|
|
4114
|
+
*/
|
|
4115
|
+
for (const key of Object.keys(event.params)) {
|
|
4116
|
+
if (event.params[key] === undefined) {
|
|
4117
|
+
delete this._params.params[key];
|
|
4118
|
+
}
|
|
4119
|
+
}
|
|
4120
|
+
// update the view with the updated props
|
|
4044
4121
|
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
|
|
4045
4122
|
}
|
|
4046
4123
|
toJSON() {
|
|
@@ -4054,9 +4131,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4054
4131
|
}
|
|
4055
4132
|
dispose() {
|
|
4056
4133
|
var _a;
|
|
4057
|
-
super.dispose();
|
|
4058
4134
|
this.api.dispose();
|
|
4059
4135
|
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
4136
|
+
super.dispose();
|
|
4060
4137
|
}
|
|
4061
4138
|
}
|
|
4062
4139
|
|
|
@@ -4435,7 +4512,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4435
4512
|
this._maximumHeight = options.maximumHeight;
|
|
4436
4513
|
}
|
|
4437
4514
|
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
|
|
4438
|
-
this.addDisposables(this.
|
|
4515
|
+
this.addDisposables(this.api.onVisibilityChange((event) => {
|
|
4439
4516
|
const { isVisible } = event;
|
|
4440
4517
|
const { accessor } = this._params;
|
|
4441
4518
|
accessor.setVisible(this, isVisible);
|
|
@@ -4464,7 +4541,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4464
4541
|
height: event.height,
|
|
4465
4542
|
width: event.width,
|
|
4466
4543
|
});
|
|
4467
|
-
}));
|
|
4544
|
+
}), this._onDidChange);
|
|
4468
4545
|
}
|
|
4469
4546
|
setVisible(isVisible) {
|
|
4470
4547
|
this.api._onDidVisibilityChange.fire({ isVisible });
|
|
@@ -4621,7 +4698,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4621
4698
|
this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
|
|
4622
4699
|
}
|
|
4623
4700
|
setTitle(title) {
|
|
4624
|
-
this.panel.
|
|
4701
|
+
this.panel.setTitle(title);
|
|
4625
4702
|
}
|
|
4626
4703
|
close() {
|
|
4627
4704
|
this.group.model.closePanel(this.panel);
|
|
@@ -4643,7 +4720,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4643
4720
|
this.id = id;
|
|
4644
4721
|
this.containerApi = containerApi;
|
|
4645
4722
|
this.view = view;
|
|
4646
|
-
this._title = '';
|
|
4647
4723
|
this._group = group;
|
|
4648
4724
|
this.api = new DockviewPanelApiImpl(this, this._group);
|
|
4649
4725
|
this.addDisposables(this.api.onActiveChange(() => {
|
|
@@ -4656,8 +4732,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4656
4732
|
}
|
|
4657
4733
|
init(params) {
|
|
4658
4734
|
this._params = params.params;
|
|
4659
|
-
this.setTitle(params.title);
|
|
4660
4735
|
this.view.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));
|
|
4736
|
+
this.setTitle(params.title);
|
|
4661
4737
|
}
|
|
4662
4738
|
focus() {
|
|
4663
4739
|
this.api._onFocusEvent.fire();
|
|
@@ -4674,11 +4750,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4674
4750
|
};
|
|
4675
4751
|
}
|
|
4676
4752
|
setTitle(title) {
|
|
4677
|
-
|
|
4678
|
-
const didTitleChange = title !== ((_a = this._params) === null || _a === void 0 ? void 0 : _a.title);
|
|
4753
|
+
const didTitleChange = title !== this.title;
|
|
4679
4754
|
if (didTitleChange) {
|
|
4680
4755
|
this._title = title;
|
|
4681
|
-
|
|
4756
|
+
this.view.update({
|
|
4682
4757
|
params: {
|
|
4683
4758
|
params: this._params,
|
|
4684
4759
|
title: this.title,
|
|
@@ -4688,14 +4763,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4688
4763
|
}
|
|
4689
4764
|
}
|
|
4690
4765
|
update(event) {
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4766
|
+
// merge the new parameters with the existing parameters
|
|
4767
|
+
this._params = Object.assign(Object.assign({}, (this._params || {})), event.params);
|
|
4768
|
+
/**
|
|
4769
|
+
* delete new keys that have a value of undefined,
|
|
4770
|
+
* allow values of null
|
|
4771
|
+
*/
|
|
4772
|
+
for (const key of Object.keys(event.params)) {
|
|
4773
|
+
if (event.params[key] === undefined) {
|
|
4774
|
+
delete this._params[key];
|
|
4775
|
+
}
|
|
4697
4776
|
}
|
|
4698
|
-
|
|
4777
|
+
// update the view with the updated props
|
|
4778
|
+
this.view.update({
|
|
4699
4779
|
params: {
|
|
4700
4780
|
params: this._params,
|
|
4701
4781
|
title: this.title,
|
|
@@ -5070,7 +5150,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5070
5150
|
size: { type: 'pixels', value: 20 },
|
|
5071
5151
|
},
|
|
5072
5152
|
});
|
|
5073
|
-
this.addDisposables(dropTarget
|
|
5153
|
+
this.addDisposables(dropTarget.onDrop((event) => {
|
|
5074
5154
|
const data = getPanelData();
|
|
5075
5155
|
if (data) {
|
|
5076
5156
|
this.moveGroupOrPanel(this.orthogonalize(event.position), data.groupId, data.panelId || undefined, 'center');
|
|
@@ -5078,7 +5158,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5078
5158
|
else {
|
|
5079
5159
|
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: null, getData: getPanelData }));
|
|
5080
5160
|
}
|
|
5081
|
-
}));
|
|
5161
|
+
}), dropTarget);
|
|
5082
5162
|
this._api = new DockviewApi(this);
|
|
5083
5163
|
this.updateWatermark();
|
|
5084
5164
|
}
|
|
@@ -5402,31 +5482,33 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5402
5482
|
}
|
|
5403
5483
|
super.doRemoveGroup(group, { skipActive });
|
|
5404
5484
|
}
|
|
5405
|
-
moveGroupOrPanel(
|
|
5485
|
+
moveGroupOrPanel(destinationGroup, sourceGroupId, sourceItemId, destinationTarget, destinationIndex) {
|
|
5406
5486
|
var _a;
|
|
5407
|
-
const sourceGroup =
|
|
5408
|
-
? (_a = this._groups.get(
|
|
5487
|
+
const sourceGroup = sourceGroupId
|
|
5488
|
+
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
5409
5489
|
: undefined;
|
|
5410
|
-
if (
|
|
5490
|
+
if (sourceItemId === undefined) {
|
|
5411
5491
|
if (sourceGroup) {
|
|
5412
|
-
this.moveGroup(sourceGroup,
|
|
5492
|
+
this.moveGroup(sourceGroup, destinationGroup, destinationTarget);
|
|
5413
5493
|
}
|
|
5414
5494
|
return;
|
|
5415
5495
|
}
|
|
5416
|
-
if (!
|
|
5417
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(
|
|
5418
|
-
this.panels.find((panel) => panel.id ===
|
|
5496
|
+
if (!destinationTarget || destinationTarget === 'center') {
|
|
5497
|
+
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(sourceItemId)) ||
|
|
5498
|
+
this.panels.find((panel) => panel.id === sourceItemId);
|
|
5419
5499
|
if (!groupItem) {
|
|
5420
|
-
throw new Error(`No panel with id ${
|
|
5500
|
+
throw new Error(`No panel with id ${sourceItemId}`);
|
|
5421
5501
|
}
|
|
5422
5502
|
if ((sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.size) === 0) {
|
|
5423
5503
|
this.doRemoveGroup(sourceGroup);
|
|
5424
5504
|
}
|
|
5425
|
-
|
|
5505
|
+
destinationGroup.model.openPanel(groupItem, {
|
|
5506
|
+
index: destinationIndex,
|
|
5507
|
+
});
|
|
5426
5508
|
}
|
|
5427
5509
|
else {
|
|
5428
|
-
const referenceLocation = getGridLocation(
|
|
5429
|
-
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation,
|
|
5510
|
+
const referenceLocation = getGridLocation(destinationGroup.element);
|
|
5511
|
+
const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5430
5512
|
if (sourceGroup && sourceGroup.size < 2) {
|
|
5431
5513
|
const [targetParentLocation, to] = tail(targetLocation);
|
|
5432
5514
|
const sourceLocation = getGridLocation(sourceGroup.element);
|
|
@@ -5444,18 +5526,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5444
5526
|
skipDispose: true,
|
|
5445
5527
|
});
|
|
5446
5528
|
// after deleting the group we need to re-evaulate the ref location
|
|
5447
|
-
const updatedReferenceLocation = getGridLocation(
|
|
5448
|
-
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation,
|
|
5529
|
+
const updatedReferenceLocation = getGridLocation(destinationGroup.element);
|
|
5530
|
+
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
5449
5531
|
this.doAddGroup(targetGroup, location);
|
|
5450
5532
|
}
|
|
5451
5533
|
}
|
|
5452
5534
|
else {
|
|
5453
|
-
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(
|
|
5454
|
-
this.panels.find((panel) => panel.id ===
|
|
5535
|
+
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(sourceItemId)) ||
|
|
5536
|
+
this.panels.find((panel) => panel.id === sourceItemId);
|
|
5455
5537
|
if (!groupItem) {
|
|
5456
|
-
throw new Error(`No panel with id ${
|
|
5538
|
+
throw new Error(`No panel with id ${sourceItemId}`);
|
|
5457
5539
|
}
|
|
5458
|
-
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation,
|
|
5540
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
5459
5541
|
const group = this.createGroupAtLocation(dropLocation);
|
|
5460
5542
|
group.model.openPanel(groupItem);
|
|
5461
5543
|
}
|
|
@@ -5549,11 +5631,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5549
5631
|
return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
|
|
5550
5632
|
}
|
|
5551
5633
|
dispose() {
|
|
5552
|
-
super.dispose();
|
|
5553
5634
|
this._onDidActivePanelChange.dispose();
|
|
5554
5635
|
this._onDidAddPanel.dispose();
|
|
5555
5636
|
this._onDidRemovePanel.dispose();
|
|
5556
5637
|
this._onDidLayoutFromJSON.dispose();
|
|
5638
|
+
super.dispose();
|
|
5557
5639
|
}
|
|
5558
5640
|
}
|
|
5559
5641
|
|
|
@@ -5811,7 +5893,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5811
5893
|
}
|
|
5812
5894
|
set splitview(value) {
|
|
5813
5895
|
this._splitview = value;
|
|
5814
|
-
this.
|
|
5896
|
+
this._splitviewChangeDisposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
|
|
5815
5897
|
this._onDidLayoutChange.fire(undefined);
|
|
5816
5898
|
}), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
|
|
5817
5899
|
}
|
|
@@ -5833,7 +5915,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5833
5915
|
}
|
|
5834
5916
|
constructor(options) {
|
|
5835
5917
|
super(options.parentElement);
|
|
5836
|
-
this.
|
|
5918
|
+
this._splitviewChangeDisposable = new MutableDisposable();
|
|
5837
5919
|
this._panels = new Map();
|
|
5838
5920
|
this._onDidLayoutfromJSON = new Emitter();
|
|
5839
5921
|
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
@@ -5851,7 +5933,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5851
5933
|
options.frameworkComponents = {};
|
|
5852
5934
|
}
|
|
5853
5935
|
this.splitview = new Splitview(this.element, options);
|
|
5854
|
-
this.addDisposables(this.
|
|
5936
|
+
this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
|
|
5855
5937
|
}
|
|
5856
5938
|
updateOptions(options) {
|
|
5857
5939
|
const hasOrientationChanged = typeof options.orientation === 'string' &&
|
|
@@ -5889,15 +5971,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5889
5971
|
}
|
|
5890
5972
|
}
|
|
5891
5973
|
removePanel(panel, sizing) {
|
|
5892
|
-
const
|
|
5893
|
-
if (!
|
|
5974
|
+
const item = this._panels.get(panel.id);
|
|
5975
|
+
if (!item) {
|
|
5894
5976
|
throw new Error(`unknown splitview panel ${panel.id}`);
|
|
5895
5977
|
}
|
|
5896
|
-
|
|
5897
|
-
disposable.value.dispose();
|
|
5978
|
+
item.dispose();
|
|
5898
5979
|
this._panels.delete(panel.id);
|
|
5899
5980
|
const index = this.panels.findIndex((_) => _ === panel);
|
|
5900
|
-
this.splitview.removeView(index, sizing);
|
|
5981
|
+
const removedView = this.splitview.removeView(index, sizing);
|
|
5982
|
+
removedView.dispose();
|
|
5901
5983
|
const panels = this.panels;
|
|
5902
5984
|
if (panels.length > 0) {
|
|
5903
5985
|
this.setActive(panels[panels.length - 1]);
|
|
@@ -5944,7 +6026,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5944
6026
|
}
|
|
5945
6027
|
this.setActive(view, true);
|
|
5946
6028
|
});
|
|
5947
|
-
this._panels.set(view.id,
|
|
6029
|
+
this._panels.set(view.id, disposable);
|
|
5948
6030
|
}
|
|
5949
6031
|
toJSON() {
|
|
5950
6032
|
var _a;
|
|
@@ -6017,20 +6099,26 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6017
6099
|
this._onDidLayoutfromJSON.fire();
|
|
6018
6100
|
}
|
|
6019
6101
|
clear() {
|
|
6020
|
-
for (const
|
|
6021
|
-
|
|
6022
|
-
value.value.dispose();
|
|
6102
|
+
for (const disposable of this._panels.values()) {
|
|
6103
|
+
disposable.dispose();
|
|
6023
6104
|
}
|
|
6024
6105
|
this._panels.clear();
|
|
6025
|
-
this.splitview.
|
|
6106
|
+
while (this.splitview.length > 0) {
|
|
6107
|
+
const view = this.splitview.removeView(0, exports.Sizing.Distribute, true);
|
|
6108
|
+
view.dispose();
|
|
6109
|
+
}
|
|
6026
6110
|
}
|
|
6027
6111
|
dispose() {
|
|
6028
|
-
for (const
|
|
6029
|
-
|
|
6030
|
-
value.value.dispose();
|
|
6112
|
+
for (const disposable of this._panels.values()) {
|
|
6113
|
+
disposable.dispose();
|
|
6031
6114
|
}
|
|
6032
6115
|
this._panels.clear();
|
|
6116
|
+
const views = this.splitview.getViews();
|
|
6117
|
+
this._splitviewChangeDisposable.dispose();
|
|
6033
6118
|
this.splitview.dispose();
|
|
6119
|
+
for (const view of views) {
|
|
6120
|
+
view.dispose();
|
|
6121
|
+
}
|
|
6034
6122
|
super.dispose();
|
|
6035
6123
|
}
|
|
6036
6124
|
}
|