dockview-core 1.14.2 → 1.15.1
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 +5 -5
- package/dist/cjs/api/component.api.js +19 -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 +24 -17
- package/dist/cjs/dockview/dockviewComponent.js +104 -47
- 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 +328 -112
- 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 +327 -111
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +328 -112
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +328 -112
- 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 +328 -112
- 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 +327 -111
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/api/component.api.d.ts +5 -5
- package/dist/esm/api/component.api.js +11 -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 +24 -17
- package/dist/esm/dockview/dockviewComponent.js +101 -48
- 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';
|
|
@@ -85,6 +85,9 @@ export class DockviewComponent extends BaseGrid {
|
|
|
85
85
|
get api() {
|
|
86
86
|
return this._api;
|
|
87
87
|
}
|
|
88
|
+
get gap() {
|
|
89
|
+
return this.gridview.margin;
|
|
90
|
+
}
|
|
88
91
|
constructor(options) {
|
|
89
92
|
var _a;
|
|
90
93
|
super({
|
|
@@ -96,6 +99,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
96
99
|
parentElement: options.parentElement,
|
|
97
100
|
disableAutoResizing: options.disableAutoResizing,
|
|
98
101
|
locked: options.locked,
|
|
102
|
+
margin: options.gap,
|
|
99
103
|
});
|
|
100
104
|
this.nextGroupId = sequentialNumberGenerator();
|
|
101
105
|
this._deserializer = new DefaultDockviewDeserialzier(this);
|
|
@@ -121,9 +125,9 @@ export class DockviewComponent extends BaseGrid {
|
|
|
121
125
|
this._onDidActivePanelChange = new Emitter();
|
|
122
126
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
123
127
|
this._onDidMovePanel = new Emitter();
|
|
128
|
+
this.onDidMovePanel = this._onDidMovePanel.event;
|
|
124
129
|
this._floatingGroups = [];
|
|
125
130
|
this._popoutGroups = [];
|
|
126
|
-
this._ignoreEvents = 0;
|
|
127
131
|
this._onDidRemoveGroup = new Emitter();
|
|
128
132
|
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
129
133
|
this._onDidAddGroup = new Emitter();
|
|
@@ -137,7 +141,9 @@ export class DockviewComponent extends BaseGrid {
|
|
|
137
141
|
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
138
142
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
139
143
|
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.
|
|
144
|
+
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(() => {
|
|
145
|
+
this.updateWatermark();
|
|
146
|
+
}), this.onDidAdd((event) => {
|
|
141
147
|
if (!this._moving) {
|
|
142
148
|
this._onDidAddGroup.fire(event);
|
|
143
149
|
}
|
|
@@ -151,7 +157,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
151
157
|
}
|
|
152
158
|
}), Event.any(this.onDidAdd, this.onDidRemove)(() => {
|
|
153
159
|
this.updateWatermark();
|
|
154
|
-
}), Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
160
|
+
}), Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidAddGroup, this.onDidRemove, this.onDidMovePanel, this.onDidActivePanelChange)(() => {
|
|
155
161
|
this._bufferOnDidLayoutChange.fire();
|
|
156
162
|
}), Disposable.from(() => {
|
|
157
163
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
@@ -251,7 +257,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
251
257
|
var _a, _b, _c;
|
|
252
258
|
if (itemToPopout instanceof DockviewPanel &&
|
|
253
259
|
itemToPopout.group.size === 1) {
|
|
254
|
-
return this.addPopoutGroup(itemToPopout.group);
|
|
260
|
+
return this.addPopoutGroup(itemToPopout.group, options);
|
|
255
261
|
}
|
|
256
262
|
const theme = getDockviewTheme(this.gridview.element);
|
|
257
263
|
const element = this.element;
|
|
@@ -402,8 +408,8 @@ export class DockviewComponent extends BaseGrid {
|
|
|
402
408
|
console.error('dockview: failed to create popout window', err);
|
|
403
409
|
});
|
|
404
410
|
}
|
|
405
|
-
addFloatingGroup(item,
|
|
406
|
-
var _a, _b, _c, _d, _e
|
|
411
|
+
addFloatingGroup(item, options) {
|
|
412
|
+
var _a, _b, _c, _d, _e;
|
|
407
413
|
let group;
|
|
408
414
|
if (item instanceof DockviewPanel) {
|
|
409
415
|
group = this.createGroup();
|
|
@@ -448,26 +454,62 @@ export class DockviewComponent extends BaseGrid {
|
|
|
448
454
|
}
|
|
449
455
|
}
|
|
450
456
|
group.model.location = { type: 'floating' };
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
457
|
+
function getAnchoredBox() {
|
|
458
|
+
if (options === null || options === void 0 ? void 0 : options.position) {
|
|
459
|
+
const result = {};
|
|
460
|
+
if ('left' in options.position) {
|
|
461
|
+
result.left = Math.max(options.position.left, 0);
|
|
462
|
+
}
|
|
463
|
+
else if ('right' in options.position) {
|
|
464
|
+
result.right = Math.max(options.position.right, 0);
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
result.left = DEFAULT_FLOATING_GROUP_POSITION.left;
|
|
468
|
+
}
|
|
469
|
+
if ('top' in options.position) {
|
|
470
|
+
result.top = Math.max(options.position.top, 0);
|
|
471
|
+
}
|
|
472
|
+
else if ('bottom' in options.position) {
|
|
473
|
+
result.bottom = Math.max(options.position.bottom, 0);
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
result.top = DEFAULT_FLOATING_GROUP_POSITION.top;
|
|
477
|
+
}
|
|
478
|
+
if (typeof options.width === 'number') {
|
|
479
|
+
result.width = Math.max(options.width, 0);
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
result.width = DEFAULT_FLOATING_GROUP_POSITION.width;
|
|
483
|
+
}
|
|
484
|
+
if (typeof options.height === 'number') {
|
|
485
|
+
result.height = Math.max(options.height, 0);
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
result.height = DEFAULT_FLOATING_GROUP_POSITION.height;
|
|
489
|
+
}
|
|
490
|
+
return result;
|
|
491
|
+
}
|
|
492
|
+
return {
|
|
493
|
+
left: typeof (options === null || options === void 0 ? void 0 : options.x) === 'number'
|
|
494
|
+
? Math.max(options.x, 0)
|
|
495
|
+
: DEFAULT_FLOATING_GROUP_POSITION.left,
|
|
496
|
+
top: typeof (options === null || options === void 0 ? void 0 : options.y) === 'number'
|
|
497
|
+
? Math.max(options.y, 0)
|
|
498
|
+
: DEFAULT_FLOATING_GROUP_POSITION.top,
|
|
499
|
+
width: typeof (options === null || options === void 0 ? void 0 : options.width) === 'number'
|
|
500
|
+
? Math.max(options.width, 0)
|
|
501
|
+
: DEFAULT_FLOATING_GROUP_POSITION.width,
|
|
502
|
+
height: typeof (options === null || options === void 0 ? void 0 : options.height) === 'number'
|
|
503
|
+
? Math.max(options.height, 0)
|
|
504
|
+
: DEFAULT_FLOATING_GROUP_POSITION.height,
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
const anchoredBox = getAnchoredBox();
|
|
508
|
+
const overlay = new Overlay(Object.assign(Object.assign({ container: this.gridview.element, content: group.element }, anchoredBox), { minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
465
509
|
? undefined
|
|
466
|
-
: (
|
|
467
|
-
minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
510
|
+
: (_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
511
|
? undefined
|
|
469
|
-
: (
|
|
470
|
-
});
|
|
512
|
+
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
|
|
471
513
|
const el = group.element.querySelector('.void-container');
|
|
472
514
|
if (!el) {
|
|
473
515
|
throw new Error('failed to find drag handle');
|
|
@@ -567,12 +609,21 @@ export class DockviewComponent extends BaseGrid {
|
|
|
567
609
|
group.overlay.minimumInViewportWidth =
|
|
568
610
|
(_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
|
|
569
611
|
}
|
|
570
|
-
group.overlay.setBounds(
|
|
612
|
+
group.overlay.setBounds();
|
|
571
613
|
}
|
|
572
614
|
}
|
|
573
615
|
if (changed_rootOverlayOptions) {
|
|
574
616
|
this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
|
|
575
617
|
}
|
|
618
|
+
if (
|
|
619
|
+
// if explicitly set as `undefined`
|
|
620
|
+
'gap' in options &&
|
|
621
|
+
options.gap === undefined) {
|
|
622
|
+
this.gridview.margin = 0;
|
|
623
|
+
}
|
|
624
|
+
if (typeof options.gap === 'number') {
|
|
625
|
+
this.gridview.margin = options.gap;
|
|
626
|
+
}
|
|
576
627
|
this.layout(this.gridview.width, this.gridview.height, true);
|
|
577
628
|
}
|
|
578
629
|
layout(width, height, forceResize) {
|
|
@@ -734,11 +785,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
734
785
|
const { data, position } = serializedFloatingGroup;
|
|
735
786
|
const group = createGroupFromSerializedState(data);
|
|
736
787
|
this.addFloatingGroup(group, {
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
}, { skipRemoveGroup: true, inDragMode: false });
|
|
788
|
+
position: position,
|
|
789
|
+
skipRemoveGroup: true,
|
|
790
|
+
inDragMode: false,
|
|
791
|
+
});
|
|
742
792
|
}
|
|
743
793
|
const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
|
|
744
794
|
for (const serializedPopoutGroup of serializedPopoutGroups) {
|
|
@@ -869,15 +919,11 @@ export class DockviewComponent extends BaseGrid {
|
|
|
869
919
|
if (options.floating) {
|
|
870
920
|
const group = this.createGroup();
|
|
871
921
|
this._onDidAddGroup.fire(group);
|
|
872
|
-
const
|
|
922
|
+
const floatingGroupOptions = typeof options.floating === 'object' &&
|
|
873
923
|
options.floating !== null
|
|
874
924
|
? options.floating
|
|
875
925
|
: {};
|
|
876
|
-
this.addFloatingGroup(group,
|
|
877
|
-
inDragMode: false,
|
|
878
|
-
skipRemoveGroup: true,
|
|
879
|
-
skipActiveGroup: true,
|
|
880
|
-
});
|
|
926
|
+
this.addFloatingGroup(group, Object.assign(Object.assign({}, floatingGroupOptions), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
|
|
881
927
|
panel = this.createPanel(options, group);
|
|
882
928
|
group.model.openPanel(panel, {
|
|
883
929
|
skipSetActive: options.inactive,
|
|
@@ -916,11 +962,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
916
962
|
options.floating !== null
|
|
917
963
|
? options.floating
|
|
918
964
|
: {};
|
|
919
|
-
this.addFloatingGroup(group, coordinates, {
|
|
920
|
-
inDragMode: false,
|
|
921
|
-
skipRemoveGroup: true,
|
|
922
|
-
skipActiveGroup: true,
|
|
923
|
-
});
|
|
965
|
+
this.addFloatingGroup(group, Object.assign(Object.assign({}, coordinates), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
|
|
924
966
|
panel = this.createPanel(options, group);
|
|
925
967
|
group.model.openPanel(panel, {
|
|
926
968
|
skipSetActive: options.inactive,
|
|
@@ -975,6 +1017,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
975
1017
|
});
|
|
976
1018
|
const watermarkContainer = document.createElement('div');
|
|
977
1019
|
watermarkContainer.className = 'dv-watermark-container';
|
|
1020
|
+
addTestId(watermarkContainer, 'watermark-component');
|
|
978
1021
|
watermarkContainer.appendChild(this.watermark.element);
|
|
979
1022
|
this.gridview.element.appendChild(watermarkContainer);
|
|
980
1023
|
}
|
|
@@ -1163,6 +1206,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1163
1206
|
this.doSetGroupAndPanelActive(destinationGroup);
|
|
1164
1207
|
this._onDidMovePanel.fire({
|
|
1165
1208
|
panel: removedPanel,
|
|
1209
|
+
from: sourceGroup,
|
|
1166
1210
|
});
|
|
1167
1211
|
}
|
|
1168
1212
|
else {
|
|
@@ -1186,6 +1230,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1186
1230
|
// if a group has one tab - we are essentially moving the 'group'
|
|
1187
1231
|
// which is equivalent to swapping two views in this case
|
|
1188
1232
|
this.gridview.moveView(sourceParentLocation, from, to);
|
|
1233
|
+
this._onDidMovePanel.fire({
|
|
1234
|
+
panel: this.getGroupPanel(sourceItemId),
|
|
1235
|
+
from: sourceGroup,
|
|
1236
|
+
});
|
|
1189
1237
|
return;
|
|
1190
1238
|
}
|
|
1191
1239
|
}
|
|
@@ -1199,6 +1247,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1199
1247
|
const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
1200
1248
|
this.movingLock(() => this.doAddGroup(targetGroup, location));
|
|
1201
1249
|
this.doSetGroupAndPanelActive(targetGroup);
|
|
1250
|
+
this._onDidMovePanel.fire({
|
|
1251
|
+
panel: this.getGroupPanel(sourceItemId),
|
|
1252
|
+
from: sourceGroup,
|
|
1253
|
+
});
|
|
1202
1254
|
}
|
|
1203
1255
|
else {
|
|
1204
1256
|
/**
|
|
@@ -1218,6 +1270,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1218
1270
|
skipSetGroupActive: true,
|
|
1219
1271
|
}));
|
|
1220
1272
|
this.doSetGroupAndPanelActive(group);
|
|
1273
|
+
this._onDidMovePanel.fire({
|
|
1274
|
+
panel: removedPanel,
|
|
1275
|
+
from: sourceGroup,
|
|
1276
|
+
});
|
|
1221
1277
|
}
|
|
1222
1278
|
}
|
|
1223
1279
|
}
|
|
@@ -1242,9 +1298,6 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1242
1298
|
}
|
|
1243
1299
|
});
|
|
1244
1300
|
this.doSetGroupAndPanelActive(to);
|
|
1245
|
-
panels.forEach((panel) => {
|
|
1246
|
-
this._onDidMovePanel.fire({ panel });
|
|
1247
|
-
});
|
|
1248
1301
|
}
|
|
1249
1302
|
else {
|
|
1250
1303
|
switch (from.api.location.type) {
|
|
@@ -1270,10 +1323,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1270
1323
|
const referenceLocation = getGridLocation(to.element);
|
|
1271
1324
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
1272
1325
|
this.gridview.addView(from, Sizing.Distribute, dropLocation);
|
|
1273
|
-
from.panels.forEach((panel) => {
|
|
1274
|
-
this._onDidMovePanel.fire({ panel });
|
|
1275
|
-
});
|
|
1276
1326
|
}
|
|
1327
|
+
from.panels.forEach((panel) => {
|
|
1328
|
+
this._onDidMovePanel.fire({ panel, from });
|
|
1329
|
+
});
|
|
1277
1330
|
}
|
|
1278
1331
|
doSetGroupActive(group) {
|
|
1279
1332
|
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 { FloatingGroupOptions } from './dockviewComponent';
|
|
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<FloatingGroupOptions> | 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;
|