dockview-core 1.14.1 → 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/tab/defaultTab.d.ts +1 -8
- package/dist/cjs/dockview/components/tab/defaultTab.js +16 -39
- 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 +333 -138
- 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 +332 -137
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +333 -138
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +333 -138
- 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 +333 -138
- 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 +332 -137
- 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/tab/defaultTab.d.ts +1 -8
- package/dist/esm/dockview/components/tab/defaultTab.js +16 -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
|
@@ -138,6 +138,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
138
138
|
parentElement: options.parentElement,
|
|
139
139
|
disableAutoResizing: options.disableAutoResizing,
|
|
140
140
|
locked: options.locked,
|
|
141
|
+
margin: options.gap,
|
|
141
142
|
}) || this;
|
|
142
143
|
_this.nextGroupId = (0, math_1.sequentialNumberGenerator)();
|
|
143
144
|
_this._deserializer = new deserializer_1.DefaultDockviewDeserialzier(_this);
|
|
@@ -163,9 +164,9 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
163
164
|
_this._onDidActivePanelChange = new events_1.Emitter();
|
|
164
165
|
_this.onDidActivePanelChange = _this._onDidActivePanelChange.event;
|
|
165
166
|
_this._onDidMovePanel = new events_1.Emitter();
|
|
167
|
+
_this.onDidMovePanel = _this._onDidMovePanel.event;
|
|
166
168
|
_this._floatingGroups = [];
|
|
167
169
|
_this._popoutGroups = [];
|
|
168
|
-
_this._ignoreEvents = 0;
|
|
169
170
|
_this._onDidRemoveGroup = new events_1.Emitter();
|
|
170
171
|
_this.onDidRemoveGroup = _this._onDidRemoveGroup.event;
|
|
171
172
|
_this._onDidAddGroup = new events_1.Emitter();
|
|
@@ -179,7 +180,9 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
179
180
|
_this.overlayRenderContainer = new overlayRenderContainer_1.OverlayRenderContainer(gready);
|
|
180
181
|
(0, dom_1.toggleClass)(_this.gridview.element, 'dv-dockview', true);
|
|
181
182
|
(0, dom_1.toggleClass)(_this.element, 'dv-debug', !!options.debug);
|
|
182
|
-
_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.
|
|
183
|
+
_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(function () {
|
|
184
|
+
_this.updateWatermark();
|
|
185
|
+
}), _this.onDidAdd(function (event) {
|
|
183
186
|
if (!_this._moving) {
|
|
184
187
|
_this._onDidAddGroup.fire(event);
|
|
185
188
|
}
|
|
@@ -193,7 +196,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
193
196
|
}
|
|
194
197
|
}), events_1.Event.any(_this.onDidAdd, _this.onDidRemove)(function () {
|
|
195
198
|
_this.updateWatermark();
|
|
196
|
-
}), events_1.Event.any(_this.onDidAddPanel, _this.onDidRemovePanel, _this.onDidActivePanelChange)(function () {
|
|
199
|
+
}), events_1.Event.any(_this.onDidAddPanel, _this.onDidRemovePanel, _this.onDidAddGroup, _this.onDidRemove, _this.onDidMovePanel, _this.onDidActivePanelChange)(function () {
|
|
197
200
|
_this._bufferOnDidLayoutChange.fire();
|
|
198
201
|
}), lifecycle_1.Disposable.from(function () {
|
|
199
202
|
var e_1, _a, e_2, _b;
|
|
@@ -525,9 +528,9 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
525
528
|
console.error('dockview: failed to create popout window', err);
|
|
526
529
|
});
|
|
527
530
|
};
|
|
528
|
-
DockviewComponent.prototype.addFloatingGroup = function (item,
|
|
531
|
+
DockviewComponent.prototype.addFloatingGroup = function (item, options) {
|
|
529
532
|
var _this = this;
|
|
530
|
-
var _a, _b, _c, _d, _e
|
|
533
|
+
var _a, _b, _c, _d, _e;
|
|
531
534
|
var group;
|
|
532
535
|
if (item instanceof dockviewPanel_1.DockviewPanel) {
|
|
533
536
|
group = this.createGroup();
|
|
@@ -578,26 +581,62 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
578
581
|
}
|
|
579
582
|
}
|
|
580
583
|
group.model.location = { type: 'floating' };
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
584
|
+
function getAnchoredBox() {
|
|
585
|
+
if (options === null || options === void 0 ? void 0 : options.position) {
|
|
586
|
+
var result = {};
|
|
587
|
+
if ('left' in options.position) {
|
|
588
|
+
result.left = Math.max(options.position.left, 0);
|
|
589
|
+
}
|
|
590
|
+
else if ('right' in options.position) {
|
|
591
|
+
result.right = Math.max(options.position.right, 0);
|
|
592
|
+
}
|
|
593
|
+
else {
|
|
594
|
+
result.left = constants_1.DEFAULT_FLOATING_GROUP_POSITION.left;
|
|
595
|
+
}
|
|
596
|
+
if ('top' in options.position) {
|
|
597
|
+
result.top = Math.max(options.position.top, 0);
|
|
598
|
+
}
|
|
599
|
+
else if ('bottom' in options.position) {
|
|
600
|
+
result.bottom = Math.max(options.position.bottom, 0);
|
|
601
|
+
}
|
|
602
|
+
else {
|
|
603
|
+
result.top = constants_1.DEFAULT_FLOATING_GROUP_POSITION.top;
|
|
604
|
+
}
|
|
605
|
+
if ('width' in options.position) {
|
|
606
|
+
result.width = Math.max(options.position.width, 0);
|
|
607
|
+
}
|
|
608
|
+
else {
|
|
609
|
+
result.width = constants_1.DEFAULT_FLOATING_GROUP_POSITION.width;
|
|
610
|
+
}
|
|
611
|
+
if ('height' in options.position) {
|
|
612
|
+
result.height = Math.max(options.position.height, 0);
|
|
613
|
+
}
|
|
614
|
+
else {
|
|
615
|
+
result.height = constants_1.DEFAULT_FLOATING_GROUP_POSITION.height;
|
|
616
|
+
}
|
|
617
|
+
return result;
|
|
618
|
+
}
|
|
619
|
+
return {
|
|
620
|
+
left: typeof (options === null || options === void 0 ? void 0 : options.x) === 'number'
|
|
621
|
+
? Math.max(options.x, 0)
|
|
622
|
+
: constants_1.DEFAULT_FLOATING_GROUP_POSITION.left,
|
|
623
|
+
top: typeof (options === null || options === void 0 ? void 0 : options.y) === 'number'
|
|
624
|
+
? Math.max(options.y, 0)
|
|
625
|
+
: constants_1.DEFAULT_FLOATING_GROUP_POSITION.top,
|
|
626
|
+
width: typeof (options === null || options === void 0 ? void 0 : options.width) === 'number'
|
|
627
|
+
? Math.max(options.width, 0)
|
|
628
|
+
: constants_1.DEFAULT_FLOATING_GROUP_POSITION.width,
|
|
629
|
+
height: typeof (options === null || options === void 0 ? void 0 : options.height) === 'number'
|
|
630
|
+
? Math.max(options.height, 0)
|
|
631
|
+
: constants_1.DEFAULT_FLOATING_GROUP_POSITION.height,
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
var anchoredBox = getAnchoredBox();
|
|
635
|
+
var overlay = new overlay_1.Overlay(__assign(__assign({ container: this.gridview.element, content: group.element }, anchoredBox), { minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
595
636
|
? undefined
|
|
596
|
-
: (
|
|
597
|
-
minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
637
|
+
: (_c = (_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport) !== null && _c !== void 0 ? _c : constants_1.DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE, minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
598
638
|
? undefined
|
|
599
|
-
: (
|
|
600
|
-
});
|
|
639
|
+
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : constants_1.DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
|
|
601
640
|
var el = group.element.querySelector('.void-container');
|
|
602
641
|
if (!el) {
|
|
603
642
|
throw new Error('failed to find drag handle');
|
|
@@ -700,7 +739,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
700
739
|
group.overlay.minimumInViewportWidth =
|
|
701
740
|
(_c = this.options.floatingGroupBounds) === null || _c === void 0 ? void 0 : _c.minimumWidthWithinViewport;
|
|
702
741
|
}
|
|
703
|
-
group.overlay.setBounds(
|
|
742
|
+
group.overlay.setBounds();
|
|
704
743
|
}
|
|
705
744
|
}
|
|
706
745
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
@@ -714,6 +753,12 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
714
753
|
if (changed_rootOverlayOptions) {
|
|
715
754
|
this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
|
|
716
755
|
}
|
|
756
|
+
if (this.gridview.margin !== 0 && options.gap === undefined) {
|
|
757
|
+
this.gridview.margin = 0;
|
|
758
|
+
}
|
|
759
|
+
if (typeof options.gap === 'number') {
|
|
760
|
+
this.gridview.margin = options.gap;
|
|
761
|
+
}
|
|
717
762
|
this.layout(this.gridview.width, this.gridview.height, true);
|
|
718
763
|
};
|
|
719
764
|
DockviewComponent.prototype.layout = function (width, height, forceResize) {
|
|
@@ -903,11 +948,10 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
903
948
|
var data_1 = serializedFloatingGroup.data, position = serializedFloatingGroup.position;
|
|
904
949
|
var group = createGroupFromSerializedState_1(data_1);
|
|
905
950
|
this.addFloatingGroup(group, {
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
}, { skipRemoveGroup: true, inDragMode: false });
|
|
951
|
+
position: position,
|
|
952
|
+
skipRemoveGroup: true,
|
|
953
|
+
inDragMode: false,
|
|
954
|
+
});
|
|
911
955
|
}
|
|
912
956
|
}
|
|
913
957
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
@@ -1132,11 +1176,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1132
1176
|
options.floating !== null
|
|
1133
1177
|
? options.floating
|
|
1134
1178
|
: {};
|
|
1135
|
-
this.addFloatingGroup(group, o, {
|
|
1136
|
-
inDragMode: false,
|
|
1137
|
-
skipRemoveGroup: true,
|
|
1138
|
-
skipActiveGroup: true,
|
|
1139
|
-
});
|
|
1179
|
+
this.addFloatingGroup(group, __assign(__assign({}, o), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
|
|
1140
1180
|
panel = this.createPanel(options, group);
|
|
1141
1181
|
group.model.openPanel(panel, {
|
|
1142
1182
|
skipSetActive: options.inactive,
|
|
@@ -1175,11 +1215,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1175
1215
|
options.floating !== null
|
|
1176
1216
|
? options.floating
|
|
1177
1217
|
: {};
|
|
1178
|
-
this.addFloatingGroup(group, coordinates, {
|
|
1179
|
-
inDragMode: false,
|
|
1180
|
-
skipRemoveGroup: true,
|
|
1181
|
-
skipActiveGroup: true,
|
|
1182
|
-
});
|
|
1218
|
+
this.addFloatingGroup(group, __assign(__assign({}, coordinates), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
|
|
1183
1219
|
panel = this.createPanel(options, group);
|
|
1184
1220
|
group.model.openPanel(panel, {
|
|
1185
1221
|
skipSetActive: options.inactive,
|
|
@@ -1235,6 +1271,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1235
1271
|
});
|
|
1236
1272
|
var watermarkContainer = document.createElement('div');
|
|
1237
1273
|
watermarkContainer.className = 'dv-watermark-container';
|
|
1274
|
+
(0, dom_1.addTestId)(watermarkContainer, 'watermark-component');
|
|
1238
1275
|
watermarkContainer.appendChild(this.watermark.element);
|
|
1239
1276
|
this.gridview.element.appendChild(watermarkContainer);
|
|
1240
1277
|
}
|
|
@@ -1439,6 +1476,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1439
1476
|
this.doSetGroupAndPanelActive(destinationGroup);
|
|
1440
1477
|
this._onDidMovePanel.fire({
|
|
1441
1478
|
panel: removedPanel_1,
|
|
1479
|
+
from: sourceGroup,
|
|
1442
1480
|
});
|
|
1443
1481
|
}
|
|
1444
1482
|
else {
|
|
@@ -1462,6 +1500,10 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1462
1500
|
// if a group has one tab - we are essentially moving the 'group'
|
|
1463
1501
|
// which is equivalent to swapping two views in this case
|
|
1464
1502
|
this.gridview.moveView(sourceParentLocation, from, to);
|
|
1503
|
+
this._onDidMovePanel.fire({
|
|
1504
|
+
panel: this.getGroupPanel(sourceItemId),
|
|
1505
|
+
from: sourceGroup,
|
|
1506
|
+
});
|
|
1465
1507
|
return;
|
|
1466
1508
|
}
|
|
1467
1509
|
}
|
|
@@ -1477,6 +1519,10 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1477
1519
|
var location_3 = (0, gridview_1.getRelativeLocation)(this.gridview.orientation, updatedReferenceLocation, destinationTarget);
|
|
1478
1520
|
this.movingLock(function () { return _this.doAddGroup(targetGroup_1, location_3); });
|
|
1479
1521
|
this.doSetGroupAndPanelActive(targetGroup_1);
|
|
1522
|
+
this._onDidMovePanel.fire({
|
|
1523
|
+
panel: this.getGroupPanel(sourceItemId),
|
|
1524
|
+
from: sourceGroup,
|
|
1525
|
+
});
|
|
1480
1526
|
}
|
|
1481
1527
|
else {
|
|
1482
1528
|
/**
|
|
@@ -1500,6 +1546,10 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1500
1546
|
});
|
|
1501
1547
|
});
|
|
1502
1548
|
this.doSetGroupAndPanelActive(group_2);
|
|
1549
|
+
this._onDidMovePanel.fire({
|
|
1550
|
+
panel: removedPanel_2,
|
|
1551
|
+
from: sourceGroup,
|
|
1552
|
+
});
|
|
1503
1553
|
}
|
|
1504
1554
|
}
|
|
1505
1555
|
};
|
|
@@ -1540,9 +1590,6 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1540
1590
|
}
|
|
1541
1591
|
});
|
|
1542
1592
|
this.doSetGroupAndPanelActive(to);
|
|
1543
|
-
panels_2.forEach(function (panel) {
|
|
1544
|
-
_this._onDidMovePanel.fire({ panel: panel });
|
|
1545
|
-
});
|
|
1546
1593
|
}
|
|
1547
1594
|
else {
|
|
1548
1595
|
switch (from.api.location.type) {
|
|
@@ -1568,10 +1615,10 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1568
1615
|
var referenceLocation = (0, gridview_1.getGridLocation)(to.element);
|
|
1569
1616
|
var dropLocation = (0, gridview_1.getRelativeLocation)(this.gridview.orientation, referenceLocation, target);
|
|
1570
1617
|
this.gridview.addView(from, splitview_1.Sizing.Distribute, dropLocation);
|
|
1571
|
-
from.panels.forEach(function (panel) {
|
|
1572
|
-
_this._onDidMovePanel.fire({ panel: panel });
|
|
1573
|
-
});
|
|
1574
1618
|
}
|
|
1619
|
+
from.panels.forEach(function (panel) {
|
|
1620
|
+
_this._onDidMovePanel.fire({ panel: panel, from: from });
|
|
1621
|
+
});
|
|
1575
1622
|
};
|
|
1576
1623
|
DockviewComponent.prototype.doSetGroupActive = function (group) {
|
|
1577
1624
|
_super.prototype.doSetGroupActive.call(this, 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/cjs/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/cjs/dom.js
CHANGED
|
@@ -26,7 +26,7 @@ var __values = (this && this.__values) || function(o) {
|
|
|
26
26
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.isInDocument = exports.getDomNodePagePosition = exports.addStyles = exports.quasiDefaultPrevented = exports.quasiPreventDefault = exports.trackFocus = exports.getElementsByTagName = exports.isAncestor = exports.toggleClass = exports.addClasses = exports.removeClasses = exports.watchElementResize = void 0;
|
|
29
|
+
exports.addTestId = exports.isInDocument = exports.getDomNodePagePosition = exports.addStyles = exports.quasiDefaultPrevented = exports.quasiPreventDefault = exports.trackFocus = exports.getElementsByTagName = exports.isAncestor = exports.toggleClass = exports.addClasses = exports.removeClasses = exports.watchElementResize = void 0;
|
|
30
30
|
var events_1 = require("./events");
|
|
31
31
|
var lifecycle_1 = require("./lifecycle");
|
|
32
32
|
function watchElementResize(element, cb) {
|
|
@@ -274,3 +274,7 @@ function isInDocument(element) {
|
|
|
274
274
|
return false;
|
|
275
275
|
}
|
|
276
276
|
exports.isInDocument = isInDocument;
|
|
277
|
+
function addTestId(element, id) {
|
|
278
|
+
element.setAttribute('data-testid', id);
|
|
279
|
+
}
|
|
280
|
+
exports.addTestId = addTestId;
|
|
@@ -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[];
|
|
@@ -64,14 +64,20 @@ var BaseGrid = /** @class */ (function (_super) {
|
|
|
64
64
|
_this.onDidActiveChange = _this._onDidActiveChange.event;
|
|
65
65
|
_this._bufferOnDidLayoutChange = new events_1.AsapEvent();
|
|
66
66
|
_this.onDidLayoutChange = _this._bufferOnDidLayoutChange.onEvent;
|
|
67
|
+
_this._onDidViewVisibilityChangeMicroTaskQueue = new events_1.AsapEvent();
|
|
68
|
+
_this.onDidViewVisibilityChangeMicroTaskQueue = _this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;
|
|
67
69
|
_this.element.style.height = '100%';
|
|
68
70
|
_this.element.style.width = '100%';
|
|
69
71
|
options.parentElement.appendChild(_this.element);
|
|
70
|
-
_this.gridview = new gridview_1.Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
72
|
+
_this.gridview = new gridview_1.Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
|
|
71
73
|
_this.gridview.locked = !!options.locked;
|
|
72
74
|
_this.element.appendChild(_this.gridview.element);
|
|
73
75
|
_this.layout(0, 0, true); // set some elements height/widths
|
|
74
|
-
_this.addDisposables(
|
|
76
|
+
_this.addDisposables(_this.gridview.onDidViewVisibilityChange(function () {
|
|
77
|
+
return _this._onDidViewVisibilityChangeMicroTaskQueue.fire();
|
|
78
|
+
}), _this.onDidViewVisibilityChangeMicroTaskQueue(function () {
|
|
79
|
+
_this.layout(_this.width, _this.height, true);
|
|
80
|
+
}), lifecycle_1.Disposable.from(function () {
|
|
75
81
|
var _a;
|
|
76
82
|
(_a = _this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(_this.element);
|
|
77
83
|
}), _this.gridview.onDidChange(function () {
|
|
@@ -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;
|
|
@@ -43,17 +43,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
43
43
|
}
|
|
44
44
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
45
45
|
};
|
|
46
|
-
var __values = (this && this.__values) || function(o) {
|
|
47
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
48
|
-
if (m) return m.call(o);
|
|
49
|
-
if (o && typeof o.length === "number") return {
|
|
50
|
-
next: function () {
|
|
51
|
-
if (o && i >= o.length) o = void 0;
|
|
52
|
-
return { value: o && o[i++], done: !o };
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
56
|
-
};
|
|
57
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
47
|
exports.BranchNode = void 0;
|
|
59
48
|
var splitview_1 = require("../splitview/splitview");
|
|
@@ -62,7 +51,7 @@ var leafNode_1 = require("./leafNode");
|
|
|
62
51
|
var lifecycle_1 = require("../lifecycle");
|
|
63
52
|
var BranchNode = /** @class */ (function (_super) {
|
|
64
53
|
__extends(BranchNode, _super);
|
|
65
|
-
function BranchNode(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, childDescriptors) {
|
|
54
|
+
function BranchNode(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, margin, childDescriptors) {
|
|
66
55
|
var _this = _super.call(this) || this;
|
|
67
56
|
_this.orientation = orientation;
|
|
68
57
|
_this.proportionalLayout = proportionalLayout;
|
|
@@ -82,6 +71,7 @@ var BranchNode = /** @class */ (function (_super) {
|
|
|
82
71
|
orientation: _this.orientation,
|
|
83
72
|
proportionalLayout: proportionalLayout,
|
|
84
73
|
styles: styles,
|
|
74
|
+
margin: margin,
|
|
85
75
|
});
|
|
86
76
|
_this.splitview.layout(_this.size, _this.orthogonalSize);
|
|
87
77
|
}
|
|
@@ -105,6 +95,7 @@ var BranchNode = /** @class */ (function (_super) {
|
|
|
105
95
|
descriptor: descriptor,
|
|
106
96
|
proportionalLayout: proportionalLayout,
|
|
107
97
|
styles: styles,
|
|
98
|
+
margin: margin,
|
|
108
99
|
});
|
|
109
100
|
}
|
|
110
101
|
_this.disabled = disabled;
|
|
@@ -253,21 +244,23 @@ var BranchNode = /** @class */ (function (_super) {
|
|
|
253
244
|
enumerable: false,
|
|
254
245
|
configurable: true
|
|
255
246
|
});
|
|
256
|
-
BranchNode.prototype
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
247
|
+
Object.defineProperty(BranchNode.prototype, "margin", {
|
|
248
|
+
get: function () {
|
|
249
|
+
return this.splitview.margin;
|
|
250
|
+
},
|
|
251
|
+
set: function (value) {
|
|
252
|
+
this.splitview.margin = value;
|
|
253
|
+
this.children.forEach(function (child) {
|
|
254
|
+
if (child instanceof BranchNode) {
|
|
255
|
+
child.margin = value;
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
enumerable: false,
|
|
260
|
+
configurable: true
|
|
261
|
+
});
|
|
262
|
+
BranchNode.prototype.setVisible = function (_visible) {
|
|
263
|
+
// noop
|
|
271
264
|
};
|
|
272
265
|
BranchNode.prototype.isChildVisible = function (index) {
|
|
273
266
|
if (index < 0 || index >= this.children.length) {
|
|
@@ -284,12 +277,13 @@ var BranchNode = /** @class */ (function (_super) {
|
|
|
284
277
|
}
|
|
285
278
|
var wereAllChildrenHidden = this.splitview.contentSize === 0;
|
|
286
279
|
this.splitview.setViewVisible(index, visible);
|
|
280
|
+
// }
|
|
287
281
|
var areAllChildrenHidden = this.splitview.contentSize === 0;
|
|
288
282
|
// If all children are hidden then the parent should hide the entire splitview
|
|
289
283
|
// If the entire splitview is hidden then the parent should show the splitview when a child is shown
|
|
290
284
|
if ((visible && wereAllChildrenHidden) ||
|
|
291
285
|
(!visible && areAllChildrenHidden)) {
|
|
292
|
-
this._onDidVisibilityChange.fire(visible);
|
|
286
|
+
this._onDidVisibilityChange.fire({ visible: visible });
|
|
293
287
|
}
|
|
294
288
|
};
|
|
295
289
|
BranchNode.prototype.moveChild = function (from, to) {
|
|
@@ -363,7 +357,8 @@ var BranchNode = /** @class */ (function (_super) {
|
|
|
363
357
|
_this._onDidChange.fire({ size: e.orthogonalSize });
|
|
364
358
|
})], __read(this.children.map(function (c, i) {
|
|
365
359
|
if (c instanceof BranchNode) {
|
|
366
|
-
return c.onDidVisibilityChange(function (
|
|
360
|
+
return c.onDidVisibilityChange(function (_a) {
|
|
361
|
+
var visible = _a.visible;
|
|
367
362
|
_this.setChildVisible(i, visible);
|
|
368
363
|
});
|
|
369
364
|
}
|
|
@@ -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;
|