dockview-core 1.14.2 → 1.15.0
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/component.api.d.ts +4 -5
- package/dist/cjs/api/component.api.js +12 -2
- package/dist/cjs/constants.d.ts +2 -0
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/dnd/overlay.d.ts +6 -4
- package/dist/cjs/dnd/overlay.js +119 -28
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +4 -2
- package/dist/cjs/dockview/dockviewComponent.d.ts +20 -17
- package/dist/cjs/dockview/dockviewComponent.js +92 -45
- package/dist/cjs/dockview/dockviewFloatingGroupPanel.d.ts +3 -12
- package/dist/cjs/dockview/options.d.ts +10 -6
- package/dist/cjs/dockview/options.js +1 -0
- package/dist/cjs/dom.d.ts +1 -0
- package/dist/cjs/dom.js +5 -1
- package/dist/cjs/gridview/baseComponentGridview.d.ts +3 -0
- package/dist/cjs/gridview/baseComponentGridview.js +8 -2
- package/dist/cjs/gridview/branchNode.d.ts +7 -3
- package/dist/cjs/gridview/branchNode.js +24 -29
- package/dist/cjs/gridview/gridview.d.ts +7 -1
- package/dist/cjs/gridview/gridview.js +31 -8
- package/dist/cjs/gridview/gridviewPanel.d.ts +1 -0
- package/dist/cjs/gridview/gridviewPanel.js +7 -0
- package/dist/cjs/math.js +5 -1
- package/dist/cjs/splitview/splitview.d.ts +13 -0
- package/dist/cjs/splitview/splitview.js +42 -12
- package/dist/cjs/types.d.ts +23 -0
- package/dist/dockview-core.amd.js +317 -110
- package/dist/dockview-core.amd.js.map +1 -1
- package/dist/dockview-core.amd.min.js +2 -2
- package/dist/dockview-core.amd.min.js.map +1 -1
- package/dist/dockview-core.amd.min.noStyle.js +2 -2
- package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
- package/dist/dockview-core.amd.noStyle.js +316 -109
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +317 -110
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +317 -110
- package/dist/dockview-core.esm.js.map +1 -1
- package/dist/dockview-core.esm.min.js +2 -2
- package/dist/dockview-core.esm.min.js.map +1 -1
- package/dist/dockview-core.js +317 -110
- package/dist/dockview-core.js.map +1 -1
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.js.map +1 -1
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.min.noStyle.js.map +1 -1
- package/dist/dockview-core.noStyle.js +316 -109
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/api/component.api.d.ts +4 -5
- package/dist/esm/api/component.api.js +8 -2
- package/dist/esm/constants.d.ts +2 -0
- package/dist/esm/constants.js +1 -1
- package/dist/esm/dnd/overlay.d.ts +6 -4
- package/dist/esm/dnd/overlay.js +108 -28
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +4 -2
- package/dist/esm/dockview/dockviewComponent.d.ts +20 -17
- package/dist/esm/dockview/dockviewComponent.js +93 -46
- package/dist/esm/dockview/dockviewFloatingGroupPanel.d.ts +3 -12
- package/dist/esm/dockview/options.d.ts +10 -6
- package/dist/esm/dockview/options.js +1 -0
- package/dist/esm/dom.d.ts +1 -0
- package/dist/esm/dom.js +3 -0
- package/dist/esm/gridview/baseComponentGridview.d.ts +3 -0
- package/dist/esm/gridview/baseComponentGridview.js +6 -2
- package/dist/esm/gridview/branchNode.d.ts +7 -3
- package/dist/esm/gridview/branchNode.js +19 -7
- package/dist/esm/gridview/gridview.d.ts +7 -1
- package/dist/esm/gridview/gridview.js +27 -8
- package/dist/esm/gridview/gridviewPanel.d.ts +1 -0
- package/dist/esm/gridview/gridviewPanel.js +3 -0
- package/dist/esm/math.js +5 -1
- package/dist/esm/splitview/splitview.d.ts +13 -0
- package/dist/esm/splitview/splitview.js +38 -12
- package/dist/esm/types.d.ts +23 -0
- package/dist/styles/dockview.css +0 -13
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ import { DockviewGroupPanel } from './dockviewGroupPanel';
|
|
|
16
16
|
import { DockviewPanelModel } from './dockviewPanelModel';
|
|
17
17
|
import { getPanelData } from '../dnd/dataTransfer';
|
|
18
18
|
import { Overlay } from '../dnd/overlay';
|
|
19
|
-
import { toggleClass, watchElementResize } from '../dom';
|
|
19
|
+
import { addTestId, toggleClass, watchElementResize } from '../dom';
|
|
20
20
|
import { DockviewFloatingGroupPanel } from './dockviewFloatingGroupPanel';
|
|
21
21
|
import { DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE, DEFAULT_FLOATING_GROUP_POSITION, } from '../constants';
|
|
22
22
|
import { OverlayRenderContainer, } from '../overlayRenderContainer';
|
|
@@ -96,6 +96,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
96
96
|
parentElement: options.parentElement,
|
|
97
97
|
disableAutoResizing: options.disableAutoResizing,
|
|
98
98
|
locked: options.locked,
|
|
99
|
+
margin: options.gap,
|
|
99
100
|
});
|
|
100
101
|
this.nextGroupId = sequentialNumberGenerator();
|
|
101
102
|
this._deserializer = new DefaultDockviewDeserialzier(this);
|
|
@@ -121,9 +122,9 @@ export class DockviewComponent extends BaseGrid {
|
|
|
121
122
|
this._onDidActivePanelChange = new Emitter();
|
|
122
123
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
123
124
|
this._onDidMovePanel = new Emitter();
|
|
125
|
+
this.onDidMovePanel = this._onDidMovePanel.event;
|
|
124
126
|
this._floatingGroups = [];
|
|
125
127
|
this._popoutGroups = [];
|
|
126
|
-
this._ignoreEvents = 0;
|
|
127
128
|
this._onDidRemoveGroup = new Emitter();
|
|
128
129
|
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
129
130
|
this._onDidAddGroup = new Emitter();
|
|
@@ -137,7 +138,9 @@ export class DockviewComponent extends BaseGrid {
|
|
|
137
138
|
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
138
139
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
139
140
|
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
140
|
-
this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this.
|
|
141
|
+
this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
|
|
142
|
+
this.updateWatermark();
|
|
143
|
+
}), this.onDidAdd((event) => {
|
|
141
144
|
if (!this._moving) {
|
|
142
145
|
this._onDidAddGroup.fire(event);
|
|
143
146
|
}
|
|
@@ -151,7 +154,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
151
154
|
}
|
|
152
155
|
}), Event.any(this.onDidAdd, this.onDidRemove)(() => {
|
|
153
156
|
this.updateWatermark();
|
|
154
|
-
}), Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
157
|
+
}), Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidAddGroup, this.onDidRemove, this.onDidMovePanel, this.onDidActivePanelChange)(() => {
|
|
155
158
|
this._bufferOnDidLayoutChange.fire();
|
|
156
159
|
}), Disposable.from(() => {
|
|
157
160
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
@@ -402,8 +405,8 @@ export class DockviewComponent extends BaseGrid {
|
|
|
402
405
|
console.error('dockview: failed to create popout window', err);
|
|
403
406
|
});
|
|
404
407
|
}
|
|
405
|
-
addFloatingGroup(item,
|
|
406
|
-
var _a, _b, _c, _d, _e
|
|
408
|
+
addFloatingGroup(item, options) {
|
|
409
|
+
var _a, _b, _c, _d, _e;
|
|
407
410
|
let group;
|
|
408
411
|
if (item instanceof DockviewPanel) {
|
|
409
412
|
group = this.createGroup();
|
|
@@ -448,26 +451,62 @@ export class DockviewComponent extends BaseGrid {
|
|
|
448
451
|
}
|
|
449
452
|
}
|
|
450
453
|
group.model.location = { type: 'floating' };
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
454
|
+
function getAnchoredBox() {
|
|
455
|
+
if (options === null || options === void 0 ? void 0 : options.position) {
|
|
456
|
+
const result = {};
|
|
457
|
+
if ('left' in options.position) {
|
|
458
|
+
result.left = Math.max(options.position.left, 0);
|
|
459
|
+
}
|
|
460
|
+
else if ('right' in options.position) {
|
|
461
|
+
result.right = Math.max(options.position.right, 0);
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
result.left = DEFAULT_FLOATING_GROUP_POSITION.left;
|
|
465
|
+
}
|
|
466
|
+
if ('top' in options.position) {
|
|
467
|
+
result.top = Math.max(options.position.top, 0);
|
|
468
|
+
}
|
|
469
|
+
else if ('bottom' in options.position) {
|
|
470
|
+
result.bottom = Math.max(options.position.bottom, 0);
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
result.top = DEFAULT_FLOATING_GROUP_POSITION.top;
|
|
474
|
+
}
|
|
475
|
+
if ('width' in options.position) {
|
|
476
|
+
result.width = Math.max(options.position.width, 0);
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
result.width = DEFAULT_FLOATING_GROUP_POSITION.width;
|
|
480
|
+
}
|
|
481
|
+
if ('height' in options.position) {
|
|
482
|
+
result.height = Math.max(options.position.height, 0);
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
result.height = DEFAULT_FLOATING_GROUP_POSITION.height;
|
|
486
|
+
}
|
|
487
|
+
return result;
|
|
488
|
+
}
|
|
489
|
+
return {
|
|
490
|
+
left: typeof (options === null || options === void 0 ? void 0 : options.x) === 'number'
|
|
491
|
+
? Math.max(options.x, 0)
|
|
492
|
+
: DEFAULT_FLOATING_GROUP_POSITION.left,
|
|
493
|
+
top: typeof (options === null || options === void 0 ? void 0 : options.y) === 'number'
|
|
494
|
+
? Math.max(options.y, 0)
|
|
495
|
+
: DEFAULT_FLOATING_GROUP_POSITION.top,
|
|
496
|
+
width: typeof (options === null || options === void 0 ? void 0 : options.width) === 'number'
|
|
497
|
+
? Math.max(options.width, 0)
|
|
498
|
+
: DEFAULT_FLOATING_GROUP_POSITION.width,
|
|
499
|
+
height: typeof (options === null || options === void 0 ? void 0 : options.height) === 'number'
|
|
500
|
+
? Math.max(options.height, 0)
|
|
501
|
+
: DEFAULT_FLOATING_GROUP_POSITION.height,
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
const anchoredBox = getAnchoredBox();
|
|
505
|
+
const overlay = new Overlay(Object.assign(Object.assign({ container: this.gridview.element, content: group.element }, anchoredBox), { minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
465
506
|
? undefined
|
|
466
|
-
: (
|
|
467
|
-
minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
507
|
+
: (_c = (_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport) !== null && _c !== void 0 ? _c : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE, minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
468
508
|
? undefined
|
|
469
|
-
: (
|
|
470
|
-
});
|
|
509
|
+
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
|
|
471
510
|
const el = group.element.querySelector('.void-container');
|
|
472
511
|
if (!el) {
|
|
473
512
|
throw new Error('failed to find drag handle');
|
|
@@ -567,12 +606,18 @@ export class DockviewComponent extends BaseGrid {
|
|
|
567
606
|
group.overlay.minimumInViewportWidth =
|
|
568
607
|
(_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
|
|
569
608
|
}
|
|
570
|
-
group.overlay.setBounds(
|
|
609
|
+
group.overlay.setBounds();
|
|
571
610
|
}
|
|
572
611
|
}
|
|
573
612
|
if (changed_rootOverlayOptions) {
|
|
574
613
|
this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
|
|
575
614
|
}
|
|
615
|
+
if (this.gridview.margin !== 0 && options.gap === undefined) {
|
|
616
|
+
this.gridview.margin = 0;
|
|
617
|
+
}
|
|
618
|
+
if (typeof options.gap === 'number') {
|
|
619
|
+
this.gridview.margin = options.gap;
|
|
620
|
+
}
|
|
576
621
|
this.layout(this.gridview.width, this.gridview.height, true);
|
|
577
622
|
}
|
|
578
623
|
layout(width, height, forceResize) {
|
|
@@ -734,11 +779,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
734
779
|
const { data, position } = serializedFloatingGroup;
|
|
735
780
|
const group = createGroupFromSerializedState(data);
|
|
736
781
|
this.addFloatingGroup(group, {
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
}, { skipRemoveGroup: true, inDragMode: false });
|
|
782
|
+
position: position,
|
|
783
|
+
skipRemoveGroup: true,
|
|
784
|
+
inDragMode: false,
|
|
785
|
+
});
|
|
742
786
|
}
|
|
743
787
|
const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
|
|
744
788
|
for (const serializedPopoutGroup of serializedPopoutGroups) {
|
|
@@ -873,11 +917,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
873
917
|
options.floating !== null
|
|
874
918
|
? options.floating
|
|
875
919
|
: {};
|
|
876
|
-
this.addFloatingGroup(group, o, {
|
|
877
|
-
inDragMode: false,
|
|
878
|
-
skipRemoveGroup: true,
|
|
879
|
-
skipActiveGroup: true,
|
|
880
|
-
});
|
|
920
|
+
this.addFloatingGroup(group, Object.assign(Object.assign({}, o), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
|
|
881
921
|
panel = this.createPanel(options, group);
|
|
882
922
|
group.model.openPanel(panel, {
|
|
883
923
|
skipSetActive: options.inactive,
|
|
@@ -916,11 +956,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
916
956
|
options.floating !== null
|
|
917
957
|
? options.floating
|
|
918
958
|
: {};
|
|
919
|
-
this.addFloatingGroup(group, coordinates, {
|
|
920
|
-
inDragMode: false,
|
|
921
|
-
skipRemoveGroup: true,
|
|
922
|
-
skipActiveGroup: true,
|
|
923
|
-
});
|
|
959
|
+
this.addFloatingGroup(group, Object.assign(Object.assign({}, coordinates), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
|
|
924
960
|
panel = this.createPanel(options, group);
|
|
925
961
|
group.model.openPanel(panel, {
|
|
926
962
|
skipSetActive: options.inactive,
|
|
@@ -975,6 +1011,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
975
1011
|
});
|
|
976
1012
|
const watermarkContainer = document.createElement('div');
|
|
977
1013
|
watermarkContainer.className = 'dv-watermark-container';
|
|
1014
|
+
addTestId(watermarkContainer, 'watermark-component');
|
|
978
1015
|
watermarkContainer.appendChild(this.watermark.element);
|
|
979
1016
|
this.gridview.element.appendChild(watermarkContainer);
|
|
980
1017
|
}
|
|
@@ -1163,6 +1200,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1163
1200
|
this.doSetGroupAndPanelActive(destinationGroup);
|
|
1164
1201
|
this._onDidMovePanel.fire({
|
|
1165
1202
|
panel: removedPanel,
|
|
1203
|
+
from: sourceGroup,
|
|
1166
1204
|
});
|
|
1167
1205
|
}
|
|
1168
1206
|
else {
|
|
@@ -1186,6 +1224,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1186
1224
|
// if a group has one tab - we are essentially moving the 'group'
|
|
1187
1225
|
// which is equivalent to swapping two views in this case
|
|
1188
1226
|
this.gridview.moveView(sourceParentLocation, from, to);
|
|
1227
|
+
this._onDidMovePanel.fire({
|
|
1228
|
+
panel: this.getGroupPanel(sourceItemId),
|
|
1229
|
+
from: sourceGroup,
|
|
1230
|
+
});
|
|
1189
1231
|
return;
|
|
1190
1232
|
}
|
|
1191
1233
|
}
|
|
@@ -1199,6 +1241,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1199
1241
|
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
1200
1242
|
this.movingLock(() => this.doAddGroup(targetGroup, location));
|
|
1201
1243
|
this.doSetGroupAndPanelActive(targetGroup);
|
|
1244
|
+
this._onDidMovePanel.fire({
|
|
1245
|
+
panel: this.getGroupPanel(sourceItemId),
|
|
1246
|
+
from: sourceGroup,
|
|
1247
|
+
});
|
|
1202
1248
|
}
|
|
1203
1249
|
else {
|
|
1204
1250
|
/**
|
|
@@ -1218,6 +1264,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1218
1264
|
skipSetGroupActive: true,
|
|
1219
1265
|
}));
|
|
1220
1266
|
this.doSetGroupAndPanelActive(group);
|
|
1267
|
+
this._onDidMovePanel.fire({
|
|
1268
|
+
panel: removedPanel,
|
|
1269
|
+
from: sourceGroup,
|
|
1270
|
+
});
|
|
1221
1271
|
}
|
|
1222
1272
|
}
|
|
1223
1273
|
}
|
|
@@ -1242,9 +1292,6 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1242
1292
|
}
|
|
1243
1293
|
});
|
|
1244
1294
|
this.doSetGroupAndPanelActive(to);
|
|
1245
|
-
panels.forEach((panel) => {
|
|
1246
|
-
this._onDidMovePanel.fire({ panel });
|
|
1247
|
-
});
|
|
1248
1295
|
}
|
|
1249
1296
|
else {
|
|
1250
1297
|
switch (from.api.location.type) {
|
|
@@ -1270,10 +1317,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1270
1317
|
const referenceLocation = getGridLocation(to.element);
|
|
1271
1318
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
1272
1319
|
this.gridview.addView(from, Sizing.Distribute, dropLocation);
|
|
1273
|
-
from.panels.forEach((panel) => {
|
|
1274
|
-
this._onDidMovePanel.fire({ panel });
|
|
1275
|
-
});
|
|
1276
1320
|
}
|
|
1321
|
+
from.panels.forEach((panel) => {
|
|
1322
|
+
this._onDidMovePanel.fire({ panel, from });
|
|
1323
|
+
});
|
|
1277
1324
|
}
|
|
1278
1325
|
doSetGroupActive(group) {
|
|
1279
1326
|
super.doSetGroupActive(group);
|
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
import { Overlay } from '../dnd/overlay';
|
|
2
2
|
import { CompositeDisposable } from '../lifecycle';
|
|
3
|
+
import { AnchoredBox } from '../types';
|
|
3
4
|
import { DockviewGroupPanel, IDockviewGroupPanel } from './dockviewGroupPanel';
|
|
4
5
|
export interface IDockviewFloatingGroupPanel {
|
|
5
6
|
readonly group: IDockviewGroupPanel;
|
|
6
|
-
position(bounds: Partial<
|
|
7
|
-
top: number;
|
|
8
|
-
left: number;
|
|
9
|
-
height: number;
|
|
10
|
-
width: number;
|
|
11
|
-
}>): void;
|
|
7
|
+
position(bounds: Partial<AnchoredBox>): void;
|
|
12
8
|
}
|
|
13
9
|
export declare class DockviewFloatingGroupPanel extends CompositeDisposable implements IDockviewFloatingGroupPanel {
|
|
14
10
|
readonly group: DockviewGroupPanel;
|
|
15
11
|
readonly overlay: Overlay;
|
|
16
12
|
constructor(group: DockviewGroupPanel, overlay: Overlay);
|
|
17
|
-
position(bounds: Partial<
|
|
18
|
-
top: number;
|
|
19
|
-
left: number;
|
|
20
|
-
height: number;
|
|
21
|
-
width: number;
|
|
22
|
-
}>): void;
|
|
13
|
+
position(bounds: Partial<AnchoredBox>): void;
|
|
23
14
|
}
|
|
@@ -11,6 +11,7 @@ import { DockviewGroupDropLocation, GroupOptions } from './dockviewGroupPanelMod
|
|
|
11
11
|
import { IDockviewPanel } from './dockviewPanel';
|
|
12
12
|
import { DockviewPanelRenderer } from '../overlayRenderContainer';
|
|
13
13
|
import { IGroupHeaderProps } from './framework';
|
|
14
|
+
import { AnchoredBox } from '../types';
|
|
14
15
|
export interface IHeaderActionsRenderer extends IDisposable {
|
|
15
16
|
readonly element: HTMLElement;
|
|
16
17
|
init(params: IGroupHeaderProps): void;
|
|
@@ -25,6 +26,10 @@ export interface ViewFactoryData {
|
|
|
25
26
|
tab?: string;
|
|
26
27
|
}
|
|
27
28
|
export interface DockviewOptions {
|
|
29
|
+
/**
|
|
30
|
+
* Disable the auto-resizing which is controlled through a `ResizeObserver`.
|
|
31
|
+
* Call `.layout(width, height)` to manually resize the container.
|
|
32
|
+
*/
|
|
28
33
|
disableAutoResizing?: boolean;
|
|
29
34
|
hideBorders?: boolean;
|
|
30
35
|
singleTabMode?: 'fullwidth' | 'default';
|
|
@@ -39,6 +44,10 @@ export interface DockviewOptions {
|
|
|
39
44
|
rootOverlayModel?: DroptargetOverlayModel;
|
|
40
45
|
locked?: boolean;
|
|
41
46
|
disableDnd?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Pixel gap between groups
|
|
49
|
+
*/
|
|
50
|
+
gap?: number;
|
|
42
51
|
}
|
|
43
52
|
export interface DockviewDndOverlayEvent {
|
|
44
53
|
nativeEvent: DragEvent;
|
|
@@ -100,12 +109,7 @@ export type AddPanelPositionOptions = RelativePanel | RelativeGroup | AbsolutePo
|
|
|
100
109
|
export declare function isPanelOptionsWithPanel(data: AddPanelPositionOptions): data is RelativePanel;
|
|
101
110
|
export declare function isPanelOptionsWithGroup(data: AddPanelPositionOptions): data is RelativeGroup;
|
|
102
111
|
type AddPanelFloatingGroupUnion = {
|
|
103
|
-
floating:
|
|
104
|
-
height?: number;
|
|
105
|
-
width?: number;
|
|
106
|
-
x?: number;
|
|
107
|
-
y?: number;
|
|
108
|
-
} | true;
|
|
112
|
+
floating: Partial<AnchoredBox> | true;
|
|
109
113
|
position: never;
|
|
110
114
|
};
|
|
111
115
|
type AddPanelPositionUnion = {
|
package/dist/esm/dom.d.ts
CHANGED
|
@@ -26,3 +26,4 @@ export declare function getDomNodePagePosition(domNode: Element): {
|
|
|
26
26
|
* @see https://terodox.tech/how-to-tell-if-an-element-is-in-the-dom-including-the-shadow-dom/
|
|
27
27
|
*/
|
|
28
28
|
export declare function isInDocument(element: Element): boolean;
|
|
29
|
+
export declare function addTestId(element: HTMLElement, id: string): void;
|
package/dist/esm/dom.js
CHANGED
|
@@ -15,6 +15,7 @@ export interface BaseGridOptions {
|
|
|
15
15
|
readonly parentElement: HTMLElement;
|
|
16
16
|
readonly disableAutoResizing?: boolean;
|
|
17
17
|
readonly locked?: boolean;
|
|
18
|
+
readonly margin?: number;
|
|
18
19
|
}
|
|
19
20
|
export interface IGridPanelView extends IGridView, IPanel {
|
|
20
21
|
setActive(isActive: boolean): void;
|
|
@@ -59,6 +60,8 @@ export declare abstract class BaseGrid<T extends IGridPanelView> extends Resizab
|
|
|
59
60
|
readonly onDidActiveChange: Event<T | undefined>;
|
|
60
61
|
protected readonly _bufferOnDidLayoutChange: AsapEvent;
|
|
61
62
|
readonly onDidLayoutChange: Event<void>;
|
|
63
|
+
private readonly _onDidViewVisibilityChangeMicroTaskQueue;
|
|
64
|
+
readonly onDidViewVisibilityChangeMicroTaskQueue: Event<void>;
|
|
62
65
|
get id(): string;
|
|
63
66
|
get size(): number;
|
|
64
67
|
get groups(): T[];
|
|
@@ -69,14 +69,18 @@ export class BaseGrid extends Resizable {
|
|
|
69
69
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
70
70
|
this._bufferOnDidLayoutChange = new AsapEvent();
|
|
71
71
|
this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
|
|
72
|
+
this._onDidViewVisibilityChangeMicroTaskQueue = new AsapEvent();
|
|
73
|
+
this.onDidViewVisibilityChangeMicroTaskQueue = this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;
|
|
72
74
|
this.element.style.height = '100%';
|
|
73
75
|
this.element.style.width = '100%';
|
|
74
76
|
options.parentElement.appendChild(this.element);
|
|
75
|
-
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
77
|
+
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
|
|
76
78
|
this.gridview.locked = !!options.locked;
|
|
77
79
|
this.element.appendChild(this.gridview.element);
|
|
78
80
|
this.layout(0, 0, true); // set some elements height/widths
|
|
79
|
-
this.addDisposables(
|
|
81
|
+
this.addDisposables(this.gridview.onDidViewVisibilityChange(() => this._onDidViewVisibilityChangeMicroTaskQueue.fire()), this.onDidViewVisibilityChangeMicroTaskQueue(() => {
|
|
82
|
+
this.layout(this.width, this.height, true);
|
|
83
|
+
}), Disposable.from(() => {
|
|
80
84
|
var _a;
|
|
81
85
|
(_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
|
|
82
86
|
}), this.gridview.onDidChange(() => {
|
|
@@ -19,7 +19,9 @@ export declare class BranchNode extends CompositeDisposable implements IView {
|
|
|
19
19
|
orthogonalSize?: number;
|
|
20
20
|
}>;
|
|
21
21
|
private readonly _onDidVisibilityChange;
|
|
22
|
-
readonly onDidVisibilityChange: Event<
|
|
22
|
+
readonly onDidVisibilityChange: Event<{
|
|
23
|
+
visible: boolean;
|
|
24
|
+
}>;
|
|
23
25
|
get width(): number;
|
|
24
26
|
get height(): number;
|
|
25
27
|
get minimumSize(): number;
|
|
@@ -35,8 +37,10 @@ export declare class BranchNode extends CompositeDisposable implements IView {
|
|
|
35
37
|
get priority(): LayoutPriority;
|
|
36
38
|
get disabled(): boolean;
|
|
37
39
|
set disabled(value: boolean);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
get margin(): number;
|
|
41
|
+
set margin(value: number);
|
|
42
|
+
constructor(orientation: Orientation, proportionalLayout: boolean, styles: ISplitviewStyles | undefined, size: number, orthogonalSize: number, disabled: boolean, margin: number | undefined, childDescriptors?: INodeDescriptor[]);
|
|
43
|
+
setVisible(_visible: boolean): void;
|
|
40
44
|
isChildVisible(index: number): boolean;
|
|
41
45
|
setChildVisible(index: number, visible: boolean): void;
|
|
42
46
|
moveChild(from: number, to: number): void;
|
|
@@ -82,7 +82,18 @@ export class BranchNode extends CompositeDisposable {
|
|
|
82
82
|
set disabled(value) {
|
|
83
83
|
this.splitview.disabled = value;
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
get margin() {
|
|
86
|
+
return this.splitview.margin;
|
|
87
|
+
}
|
|
88
|
+
set margin(value) {
|
|
89
|
+
this.splitview.margin = value;
|
|
90
|
+
this.children.forEach((child) => {
|
|
91
|
+
if (child instanceof BranchNode) {
|
|
92
|
+
child.margin = value;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
constructor(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, margin, childDescriptors) {
|
|
86
97
|
super();
|
|
87
98
|
this.orientation = orientation;
|
|
88
99
|
this.proportionalLayout = proportionalLayout;
|
|
@@ -102,6 +113,7 @@ export class BranchNode extends CompositeDisposable {
|
|
|
102
113
|
orientation: this.orientation,
|
|
103
114
|
proportionalLayout,
|
|
104
115
|
styles,
|
|
116
|
+
margin,
|
|
105
117
|
});
|
|
106
118
|
this.splitview.layout(this.size, this.orthogonalSize);
|
|
107
119
|
}
|
|
@@ -125,6 +137,7 @@ export class BranchNode extends CompositeDisposable {
|
|
|
125
137
|
descriptor,
|
|
126
138
|
proportionalLayout,
|
|
127
139
|
styles,
|
|
140
|
+
margin,
|
|
128
141
|
});
|
|
129
142
|
}
|
|
130
143
|
this.disabled = disabled;
|
|
@@ -133,10 +146,8 @@ export class BranchNode extends CompositeDisposable {
|
|
|
133
146
|
}));
|
|
134
147
|
this.setupChildrenEvents();
|
|
135
148
|
}
|
|
136
|
-
setVisible(
|
|
137
|
-
|
|
138
|
-
child.setVisible(visible);
|
|
139
|
-
}
|
|
149
|
+
setVisible(_visible) {
|
|
150
|
+
// noop
|
|
140
151
|
}
|
|
141
152
|
isChildVisible(index) {
|
|
142
153
|
if (index < 0 || index >= this.children.length) {
|
|
@@ -153,12 +164,13 @@ export class BranchNode extends CompositeDisposable {
|
|
|
153
164
|
}
|
|
154
165
|
const wereAllChildrenHidden = this.splitview.contentSize === 0;
|
|
155
166
|
this.splitview.setViewVisible(index, visible);
|
|
167
|
+
// }
|
|
156
168
|
const areAllChildrenHidden = this.splitview.contentSize === 0;
|
|
157
169
|
// If all children are hidden then the parent should hide the entire splitview
|
|
158
170
|
// If the entire splitview is hidden then the parent should show the splitview when a child is shown
|
|
159
171
|
if ((visible && wereAllChildrenHidden) ||
|
|
160
172
|
(!visible && areAllChildrenHidden)) {
|
|
161
|
-
this._onDidVisibilityChange.fire(visible);
|
|
173
|
+
this._onDidVisibilityChange.fire({ visible });
|
|
162
174
|
}
|
|
163
175
|
}
|
|
164
176
|
moveChild(from, to) {
|
|
@@ -231,7 +243,7 @@ export class BranchNode extends CompositeDisposable {
|
|
|
231
243
|
this._onDidChange.fire({ size: e.orthogonalSize });
|
|
232
244
|
}), ...this.children.map((c, i) => {
|
|
233
245
|
if (c instanceof BranchNode) {
|
|
234
|
-
return c.onDidVisibilityChange((visible) => {
|
|
246
|
+
return c.onDidVisibilityChange(({ visible }) => {
|
|
235
247
|
this.setChildVisible(i, visible);
|
|
236
248
|
});
|
|
237
249
|
}
|
|
@@ -26,6 +26,7 @@ export interface IGridView {
|
|
|
26
26
|
readonly maximumWidth: number;
|
|
27
27
|
readonly minimumHeight: number;
|
|
28
28
|
readonly maximumHeight: number;
|
|
29
|
+
readonly isVisible: boolean;
|
|
29
30
|
priority?: LayoutPriority;
|
|
30
31
|
layout(width: number, height: number): void;
|
|
31
32
|
toJSON(): object;
|
|
@@ -88,6 +89,7 @@ export declare class Gridview implements IDisposable {
|
|
|
88
89
|
readonly element: HTMLElement;
|
|
89
90
|
private _root;
|
|
90
91
|
private _locked;
|
|
92
|
+
private _margin;
|
|
91
93
|
private _maximizedNode;
|
|
92
94
|
private readonly disposable;
|
|
93
95
|
private readonly _onDidChange;
|
|
@@ -95,6 +97,8 @@ export declare class Gridview implements IDisposable {
|
|
|
95
97
|
size?: number;
|
|
96
98
|
orthogonalSize?: number;
|
|
97
99
|
}>;
|
|
100
|
+
private readonly _onDidViewVisibilityChange;
|
|
101
|
+
readonly onDidViewVisibilityChange: Event<void>;
|
|
98
102
|
private readonly _onDidMaximizedNodeChange;
|
|
99
103
|
readonly onDidMaximizedNodeChange: Event<void>;
|
|
100
104
|
get length(): number;
|
|
@@ -108,6 +112,8 @@ export declare class Gridview implements IDisposable {
|
|
|
108
112
|
get maximumHeight(): number;
|
|
109
113
|
get locked(): boolean;
|
|
110
114
|
set locked(value: boolean);
|
|
115
|
+
get margin(): number;
|
|
116
|
+
set margin(value: number);
|
|
111
117
|
maximizedView(): IGridView | undefined;
|
|
112
118
|
hasMaximizedView(): boolean;
|
|
113
119
|
maximizeView(view: IGridView): void;
|
|
@@ -131,7 +137,7 @@ export declare class Gridview implements IDisposable {
|
|
|
131
137
|
getView(location?: number[]): GridNode<IGridView>;
|
|
132
138
|
private _getViews;
|
|
133
139
|
private progmaticSelect;
|
|
134
|
-
constructor(proportionalLayout: boolean, styles: ISplitviewStyles | undefined, orientation: Orientation);
|
|
140
|
+
constructor(proportionalLayout: boolean, styles: ISplitviewStyles | undefined, orientation: Orientation, locked?: boolean, margin?: number);
|
|
135
141
|
isViewVisible(location: number[]): boolean;
|
|
136
142
|
setViewVisible(location: number[], visible: boolean): void;
|
|
137
143
|
moveView(parentLocation: number[], from: number, to: number): void;
|
|
@@ -19,7 +19,7 @@ function findLeaf(candiateNode, last) {
|
|
|
19
19
|
}
|
|
20
20
|
function flipNode(node, size, orthogonalSize) {
|
|
21
21
|
if (node instanceof BranchNode) {
|
|
22
|
-
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled);
|
|
22
|
+
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled, node.margin);
|
|
23
23
|
let totalSize = 0;
|
|
24
24
|
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
25
25
|
const child = node.children[i];
|
|
@@ -174,6 +174,13 @@ export class Gridview {
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
+
get margin() {
|
|
178
|
+
return this._margin;
|
|
179
|
+
}
|
|
180
|
+
set margin(value) {
|
|
181
|
+
this._margin = value;
|
|
182
|
+
this.root.margin = value;
|
|
183
|
+
}
|
|
177
184
|
maximizedView() {
|
|
178
185
|
var _a;
|
|
179
186
|
return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf.view;
|
|
@@ -259,13 +266,14 @@ export class Gridview {
|
|
|
259
266
|
this.disposable.dispose();
|
|
260
267
|
this._onDidChange.dispose();
|
|
261
268
|
this._onDidMaximizedNodeChange.dispose();
|
|
269
|
+
this._onDidViewVisibilityChange.dispose();
|
|
262
270
|
this.root.dispose();
|
|
263
271
|
this._maximizedNode = undefined;
|
|
264
272
|
this.element.remove();
|
|
265
273
|
}
|
|
266
274
|
clear() {
|
|
267
275
|
const orientation = this.root.orientation;
|
|
268
|
-
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this.
|
|
276
|
+
this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this.locked, this.margin);
|
|
269
277
|
}
|
|
270
278
|
deserialize(json, deserializer) {
|
|
271
279
|
const orientation = json.orientation;
|
|
@@ -276,6 +284,7 @@ export class Gridview {
|
|
|
276
284
|
this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize);
|
|
277
285
|
}
|
|
278
286
|
_deserializeNode(node, orientation, deserializer, orthogonalSize) {
|
|
287
|
+
var _a;
|
|
279
288
|
let result;
|
|
280
289
|
if (node.type === 'branch') {
|
|
281
290
|
const serializedChildren = node.data;
|
|
@@ -287,10 +296,14 @@ export class Gridview {
|
|
|
287
296
|
});
|
|
288
297
|
result = new BranchNode(orientation, this.proportionalLayout, this.styles, node.size, // <- orthogonal size - flips at each depth
|
|
289
298
|
orthogonalSize, // <- size - flips at each depth,
|
|
290
|
-
this.
|
|
299
|
+
this.locked, this.margin, children);
|
|
291
300
|
}
|
|
292
301
|
else {
|
|
293
|
-
|
|
302
|
+
const view = deserializer.fromJSON(node);
|
|
303
|
+
if (typeof node.visible === 'boolean') {
|
|
304
|
+
(_a = view.setVisible) === null || _a === void 0 ? void 0 : _a.call(view, node.visible);
|
|
305
|
+
}
|
|
306
|
+
result = new LeafNode(view, orientation, orthogonalSize, node.size);
|
|
294
307
|
}
|
|
295
308
|
return result;
|
|
296
309
|
}
|
|
@@ -320,7 +333,7 @@ export class Gridview {
|
|
|
320
333
|
}
|
|
321
334
|
const oldRoot = this.root;
|
|
322
335
|
oldRoot.element.remove();
|
|
323
|
-
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this.
|
|
336
|
+
this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this.locked, this.margin);
|
|
324
337
|
if (oldRoot.children.length === 0) {
|
|
325
338
|
// no data so no need to add anything back in
|
|
326
339
|
}
|
|
@@ -387,19 +400,24 @@ export class Gridview {
|
|
|
387
400
|
}
|
|
388
401
|
return findLeaf(this.root, reverse);
|
|
389
402
|
}
|
|
390
|
-
constructor(proportionalLayout, styles, orientation) {
|
|
403
|
+
constructor(proportionalLayout, styles, orientation, locked, margin) {
|
|
391
404
|
this.proportionalLayout = proportionalLayout;
|
|
392
405
|
this.styles = styles;
|
|
393
406
|
this._locked = false;
|
|
407
|
+
this._margin = 0;
|
|
394
408
|
this._maximizedNode = undefined;
|
|
395
409
|
this.disposable = new MutableDisposable();
|
|
396
410
|
this._onDidChange = new Emitter();
|
|
397
411
|
this.onDidChange = this._onDidChange.event;
|
|
412
|
+
this._onDidViewVisibilityChange = new Emitter();
|
|
413
|
+
this.onDidViewVisibilityChange = this._onDidViewVisibilityChange.event;
|
|
398
414
|
this._onDidMaximizedNodeChange = new Emitter();
|
|
399
415
|
this.onDidMaximizedNodeChange = this._onDidMaximizedNodeChange.event;
|
|
400
416
|
this.element = document.createElement('div');
|
|
401
417
|
this.element.className = 'grid-view';
|
|
402
|
-
this.
|
|
418
|
+
this._locked = locked !== null && locked !== void 0 ? locked : false;
|
|
419
|
+
this._margin = margin !== null && margin !== void 0 ? margin : 0;
|
|
420
|
+
this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0, this.locked, this.margin);
|
|
403
421
|
}
|
|
404
422
|
isViewVisible(location) {
|
|
405
423
|
const [rest, index] = tail(location);
|
|
@@ -418,6 +436,7 @@ export class Gridview {
|
|
|
418
436
|
if (!(parent instanceof BranchNode)) {
|
|
419
437
|
throw new Error('Invalid from location');
|
|
420
438
|
}
|
|
439
|
+
this._onDidViewVisibilityChange.fire();
|
|
421
440
|
parent.setChildVisible(index, visible);
|
|
422
441
|
}
|
|
423
442
|
moveView(parentLocation, from, to) {
|
|
@@ -450,7 +469,7 @@ export class Gridview {
|
|
|
450
469
|
}
|
|
451
470
|
const child = grandParent.removeChild(parentIndex);
|
|
452
471
|
child.dispose();
|
|
453
|
-
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this.
|
|
472
|
+
const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this.locked, this.margin);
|
|
454
473
|
grandParent.addChild(newParent, parent.size, parentIndex);
|
|
455
474
|
const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
|
|
456
475
|
newParent.addChild(newSibling, newSiblingSize, 0);
|