dockview 1.4.3 → 1.5.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/README.md +1 -1
- package/dist/cjs/dockview/components/tab/defaultTab.d.ts +1 -0
- package/dist/cjs/dockview/components/tab/defaultTab.js +6 -3
- package/dist/cjs/dockview/components/tab/defaultTab.js.map +1 -1
- package/dist/cjs/dockview/components/watermark/watermark.js +3 -1
- package/dist/cjs/dockview/components/watermark/watermark.js.map +1 -1
- package/dist/cjs/dockview/defaultGroupPanelView.d.ts +1 -5
- package/dist/cjs/dockview/defaultGroupPanelView.js +5 -20
- package/dist/cjs/dockview/defaultGroupPanelView.js.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts +1 -1
- package/dist/cjs/dockview/dockviewComponent.js +7 -18
- package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
- package/dist/cjs/dockview/options.d.ts +5 -0
- package/dist/cjs/groupview/groupview.d.ts +16 -15
- package/dist/cjs/groupview/groupview.js +24 -33
- package/dist/cjs/groupview/groupview.js.map +1 -1
- package/dist/cjs/groupview/tab.d.ts +1 -0
- package/dist/cjs/groupview/tab.js +2 -1
- package/dist/cjs/groupview/tab.js.map +1 -1
- package/dist/cjs/groupview/titlebar/tabsContainer.js +1 -1
- package/dist/cjs/groupview/titlebar/tabsContainer.js.map +1 -1
- package/dist/cjs/groupview/types.d.ts +0 -4
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/paneview/defaultPaneviewHeader.d.ts +3 -0
- package/dist/cjs/paneview/defaultPaneviewHeader.js +29 -5
- package/dist/cjs/paneview/defaultPaneviewHeader.js.map +1 -1
- package/dist/cjs/paneview/draggablePaneviewPanel.d.ts +3 -1
- package/dist/cjs/paneview/draggablePaneviewPanel.js +24 -9
- package/dist/cjs/paneview/draggablePaneviewPanel.js.map +1 -1
- package/dist/cjs/paneview/options.d.ts +2 -0
- package/dist/cjs/paneview/paneviewComponent.d.ts +12 -1
- package/dist/cjs/paneview/paneviewComponent.js +13 -1
- package/dist/cjs/paneview/paneviewComponent.js.map +1 -1
- package/dist/cjs/react/deserializer.js +13 -5
- package/dist/cjs/react/deserializer.js.map +1 -1
- package/dist/cjs/react/dockview/defaultTab.d.ts +4 -0
- package/dist/cjs/react/dockview/defaultTab.js +73 -0
- package/dist/cjs/react/dockview/defaultTab.js.map +1 -0
- package/dist/cjs/react/dockview/dockview.d.ts +3 -0
- package/dist/cjs/react/dockview/dockview.js +45 -3
- package/dist/cjs/react/dockview/dockview.js.map +1 -1
- package/dist/cjs/react/dockview/groupControlsRenderer.d.ts +43 -0
- package/dist/cjs/react/dockview/groupControlsRenderer.js +87 -0
- package/dist/cjs/react/dockview/groupControlsRenderer.js.map +1 -0
- package/dist/cjs/react/dockview/reactContentPart.d.ts +1 -16
- package/dist/cjs/react/dockview/reactContentPart.js +2 -18
- package/dist/cjs/react/dockview/reactContentPart.js.map +1 -1
- package/dist/cjs/react/dockview/reactHeaderPart.d.ts +2 -0
- package/dist/cjs/react/dockview/reactHeaderPart.js +4 -0
- package/dist/cjs/react/dockview/reactHeaderPart.js.map +1 -1
- package/dist/cjs/react/index.d.ts +2 -2
- package/dist/cjs/react/index.js +1 -2
- package/dist/cjs/react/index.js.map +1 -1
- package/dist/cjs/react/paneview/paneview.d.ts +2 -0
- package/dist/cjs/react/paneview/paneview.js +9 -0
- package/dist/cjs/react/paneview/paneview.js.map +1 -1
- package/dist/cjs/react/react.d.ts +1 -0
- package/dist/cjs/react/react.js +12 -2
- package/dist/cjs/react/react.js.map +1 -1
- package/dist/cjs/react/svg.d.ts +3 -0
- package/dist/cjs/react/svg.js +36 -0
- package/dist/cjs/react/svg.js.map +1 -0
- package/dist/cjs/svg.d.ts +3 -0
- package/dist/cjs/svg.js +44 -0
- package/dist/cjs/svg.js.map +1 -0
- package/dist/dockview.amd.js +327 -113
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.noStyle.js +326 -112
- package/dist/dockview.cjs.js +327 -113
- package/dist/dockview.esm.js +327 -112
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.js +327 -113
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.noStyle.js +326 -112
- package/dist/esm/dockview/components/tab/defaultTab.d.ts +1 -0
- package/dist/esm/dockview/components/tab/defaultTab.js +5 -2
- package/dist/esm/dockview/components/watermark/watermark.js +3 -1
- package/dist/esm/dockview/defaultGroupPanelView.d.ts +1 -5
- package/dist/esm/dockview/defaultGroupPanelView.js +5 -16
- package/dist/esm/dockview/dockviewComponent.d.ts +1 -1
- package/dist/esm/dockview/dockviewComponent.js +7 -18
- package/dist/esm/dockview/options.d.ts +5 -0
- package/dist/esm/groupview/groupview.d.ts +16 -15
- package/dist/esm/groupview/groupview.js +23 -32
- package/dist/esm/groupview/tab.d.ts +1 -0
- package/dist/esm/groupview/tab.js +2 -1
- package/dist/esm/groupview/titlebar/tabsContainer.js +1 -1
- package/dist/esm/groupview/types.d.ts +0 -4
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/paneview/defaultPaneviewHeader.d.ts +3 -0
- package/dist/esm/paneview/defaultPaneviewHeader.js +29 -5
- package/dist/esm/paneview/draggablePaneviewPanel.d.ts +3 -1
- package/dist/esm/paneview/draggablePaneviewPanel.js +24 -9
- package/dist/esm/paneview/options.d.ts +2 -0
- package/dist/esm/paneview/paneviewComponent.d.ts +12 -1
- package/dist/esm/paneview/paneviewComponent.js +9 -1
- package/dist/esm/react/deserializer.js +13 -5
- package/dist/esm/react/dockview/defaultTab.d.ts +4 -0
- package/dist/esm/react/dockview/defaultTab.js +34 -0
- package/dist/esm/react/dockview/dockview.d.ts +3 -0
- package/dist/esm/react/dockview/dockview.js +30 -1
- package/dist/esm/react/dockview/groupControlsRenderer.d.ts +43 -0
- package/dist/esm/react/dockview/groupControlsRenderer.js +68 -0
- package/dist/esm/react/dockview/reactContentPart.d.ts +1 -16
- package/dist/esm/react/dockview/reactContentPart.js +2 -14
- package/dist/esm/react/dockview/reactHeaderPart.d.ts +2 -0
- package/dist/esm/react/dockview/reactHeaderPart.js +4 -0
- package/dist/esm/react/index.d.ts +2 -2
- package/dist/esm/react/index.js +1 -2
- package/dist/esm/react/paneview/paneview.d.ts +2 -0
- package/dist/esm/react/paneview/paneview.js +9 -0
- package/dist/esm/react/react.d.ts +1 -0
- package/dist/esm/react/react.js +12 -2
- package/dist/esm/react/svg.d.ts +3 -0
- package/dist/esm/react/svg.js +7 -0
- package/dist/esm/svg.d.ts +3 -0
- package/dist/esm/svg.js +31 -0
- package/dist/styles/dockview.css +155 -42
- package/package.json +2 -2
package/dist/dockview.noStyle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.5.0
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -2682,6 +2682,7 @@
|
|
|
2682
2682
|
constructor(panelId, accessor, group) {
|
|
2683
2683
|
super();
|
|
2684
2684
|
this.panelId = panelId;
|
|
2685
|
+
this.accessor = accessor;
|
|
2685
2686
|
this.group = group;
|
|
2686
2687
|
this._onChanged = new Emitter();
|
|
2687
2688
|
this.onChanged = this._onChanged.event;
|
|
@@ -2732,7 +2733,7 @@
|
|
|
2732
2733
|
validOverlays: 'none',
|
|
2733
2734
|
canDisplayOverlay: (event) => {
|
|
2734
2735
|
const data = getPanelData();
|
|
2735
|
-
if (data) {
|
|
2736
|
+
if (data && this.accessor.id === data.viewId) {
|
|
2736
2737
|
return this.panelId !== data.panelId;
|
|
2737
2738
|
}
|
|
2738
2739
|
return this.group.model.canDisplayOverlay(event, exports.DockviewDropTargets.Tab);
|
|
@@ -2790,7 +2791,7 @@
|
|
|
2790
2791
|
canDisplayOverlay: (event) => {
|
|
2791
2792
|
var _a;
|
|
2792
2793
|
const data = getPanelData();
|
|
2793
|
-
if (data) {
|
|
2794
|
+
if (data && this.accessor.id === data.viewId) {
|
|
2794
2795
|
// don't show the overlay if the tab being dragged is the last panel of this group
|
|
2795
2796
|
return ((_a = last(this.tabs)) === null || _a === void 0 ? void 0 : _a.value.panelId) !== data.panelId;
|
|
2796
2797
|
}
|
|
@@ -2947,12 +2948,6 @@
|
|
|
2947
2948
|
}
|
|
2948
2949
|
}
|
|
2949
2950
|
|
|
2950
|
-
exports.GroupChangeKind2 = void 0;
|
|
2951
|
-
(function (GroupChangeKind2) {
|
|
2952
|
-
GroupChangeKind2["ADD_PANEL"] = "ADD_PANEL";
|
|
2953
|
-
GroupChangeKind2["REMOVE_PANEL"] = "REMOVE_PANEL";
|
|
2954
|
-
GroupChangeKind2["PANEL_ACTIVE"] = "PANEL_ACTIVE";
|
|
2955
|
-
})(exports.GroupChangeKind2 || (exports.GroupChangeKind2 = {}));
|
|
2956
2951
|
class Groupview extends CompositeDisposable {
|
|
2957
2952
|
constructor(container, accessor, id, options, parent) {
|
|
2958
2953
|
super();
|
|
@@ -2971,12 +2966,15 @@
|
|
|
2971
2966
|
this._panels = [];
|
|
2972
2967
|
this._onMove = new Emitter();
|
|
2973
2968
|
this.onMove = this._onMove.event;
|
|
2974
|
-
this._onDidGroupChange = new Emitter();
|
|
2975
|
-
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
2976
2969
|
this._onDidDrop = new Emitter();
|
|
2977
2970
|
this.onDidDrop = this._onDidDrop.event;
|
|
2971
|
+
this._onDidAddPanel = new Emitter();
|
|
2972
|
+
this.onDidAddPanel = this._onDidAddPanel.event;
|
|
2973
|
+
this._onDidRemovePanel = new Emitter();
|
|
2974
|
+
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
2975
|
+
this._onDidActivePanelChange = new Emitter();
|
|
2976
|
+
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
2978
2977
|
this.container.classList.add('groupview');
|
|
2979
|
-
this.addDisposables(this._onMove, this._onDidGroupChange, this._onDidChange, this._onDidDrop);
|
|
2980
2978
|
this.tabsContainer = new TabsContainer(this.accessor, this.parent, {
|
|
2981
2979
|
tabHeight: options.tabHeight,
|
|
2982
2980
|
});
|
|
@@ -2988,7 +2986,7 @@
|
|
|
2988
2986
|
return false;
|
|
2989
2987
|
}
|
|
2990
2988
|
const data = getPanelData();
|
|
2991
|
-
if (data) {
|
|
2989
|
+
if (data && data.viewId === this.accessor.id) {
|
|
2992
2990
|
const groupHasOnePanelAndIsActiveDragElement = this._panels.length === 1 && data.groupId === this.id;
|
|
2993
2991
|
return !groupHasOnePanelAndIsActiveDragElement;
|
|
2994
2992
|
}
|
|
@@ -2998,7 +2996,7 @@
|
|
|
2998
2996
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
2999
2997
|
this.header.hidden = !!options.hideHeader;
|
|
3000
2998
|
this.locked = !!options.locked;
|
|
3001
|
-
this.addDisposables(this._onMove, this.
|
|
2999
|
+
this.addDisposables(this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this.tabsContainer.onDrop((event) => {
|
|
3002
3000
|
this.handleDropEvent(event.event, exports.Position.Center, event.index);
|
|
3003
3001
|
}), this.contentContainer.onDidFocus(() => {
|
|
3004
3002
|
this.accessor.doSetGroupActive(this.parent, true);
|
|
@@ -3070,6 +3068,15 @@
|
|
|
3070
3068
|
// correctly initialized
|
|
3071
3069
|
this.setActive(this.isActive, true, true);
|
|
3072
3070
|
this.updateContainer();
|
|
3071
|
+
if (this.accessor.options.createGroupControlElement) {
|
|
3072
|
+
this._control = this.accessor.options.createGroupControlElement(this.parent);
|
|
3073
|
+
this.addDisposables(this._control);
|
|
3074
|
+
this._control.init({
|
|
3075
|
+
containerApi: new DockviewApi(this.accessor),
|
|
3076
|
+
api: this.parent.api,
|
|
3077
|
+
});
|
|
3078
|
+
this.tabsContainer.setActionElement(this._control.element);
|
|
3079
|
+
}
|
|
3073
3080
|
}
|
|
3074
3081
|
indexOf(panel) {
|
|
3075
3082
|
return this.tabsContainer.indexOf(panel.id);
|
|
@@ -3200,14 +3207,8 @@
|
|
|
3200
3207
|
isPanelActive(panel) {
|
|
3201
3208
|
return this._activePanel === panel;
|
|
3202
3209
|
}
|
|
3203
|
-
updateActions() {
|
|
3204
|
-
|
|
3205
|
-
if (this.isActive && ((_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.actions)) {
|
|
3206
|
-
this.tabsContainer.setActionElement(this._activePanel.view.actions.element);
|
|
3207
|
-
}
|
|
3208
|
-
else {
|
|
3209
|
-
this.tabsContainer.setActionElement(undefined);
|
|
3210
|
-
}
|
|
3210
|
+
updateActions(element) {
|
|
3211
|
+
this.tabsContainer.setActionElement(element);
|
|
3211
3212
|
}
|
|
3212
3213
|
setActive(isGroupActive, skipFocus = false, force = false) {
|
|
3213
3214
|
var _a, _b;
|
|
@@ -3263,10 +3264,7 @@
|
|
|
3263
3264
|
if (this.mostRecentlyUsed.includes(panel)) {
|
|
3264
3265
|
this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
|
|
3265
3266
|
}
|
|
3266
|
-
this.
|
|
3267
|
-
kind: exports.GroupChangeKind2.REMOVE_PANEL,
|
|
3268
|
-
panel,
|
|
3269
|
-
});
|
|
3267
|
+
this._onDidRemovePanel.fire({ panel });
|
|
3270
3268
|
}
|
|
3271
3269
|
doAddPanel(panel, index = this.panels.length, skipSetActive = false) {
|
|
3272
3270
|
const existingPanel = this._panels.indexOf(panel);
|
|
@@ -3283,10 +3281,7 @@
|
|
|
3283
3281
|
}
|
|
3284
3282
|
this.updateMru(panel);
|
|
3285
3283
|
this.panels.splice(index, 0, panel);
|
|
3286
|
-
this.
|
|
3287
|
-
kind: exports.GroupChangeKind2.ADD_PANEL,
|
|
3288
|
-
panel,
|
|
3289
|
-
});
|
|
3284
|
+
this._onDidAddPanel.fire({ panel });
|
|
3290
3285
|
}
|
|
3291
3286
|
doSetActivePanel(panel) {
|
|
3292
3287
|
this._activePanel = panel;
|
|
@@ -3294,10 +3289,7 @@
|
|
|
3294
3289
|
this.tabsContainer.setActivePanel(panel);
|
|
3295
3290
|
panel.layout(this._width, this._height);
|
|
3296
3291
|
this.updateMru(panel);
|
|
3297
|
-
this.
|
|
3298
|
-
kind: exports.GroupChangeKind2.PANEL_ACTIVE,
|
|
3299
|
-
panel,
|
|
3300
|
-
});
|
|
3292
|
+
this._onDidActivePanelChange.fire({ panel });
|
|
3301
3293
|
}
|
|
3302
3294
|
}
|
|
3303
3295
|
updateMru(panel) {
|
|
@@ -3307,7 +3299,6 @@
|
|
|
3307
3299
|
this.mostRecentlyUsed = [panel, ...this.mostRecentlyUsed];
|
|
3308
3300
|
}
|
|
3309
3301
|
updateContainer() {
|
|
3310
|
-
this.updateActions();
|
|
3311
3302
|
toggleClass(this.container, 'empty', this.isEmpty);
|
|
3312
3303
|
this.panels.forEach((panel) => panel.updateParentGroup(this.parent, this.isActive));
|
|
3313
3304
|
if (this.isEmpty && !this.watermark) {
|
|
@@ -3344,6 +3335,7 @@
|
|
|
3344
3335
|
nativeEvent: event,
|
|
3345
3336
|
target,
|
|
3346
3337
|
group: this.accessor.getPanel(this.id),
|
|
3338
|
+
getData: getPanelData,
|
|
3347
3339
|
});
|
|
3348
3340
|
}
|
|
3349
3341
|
return false;
|
|
@@ -3392,7 +3384,7 @@
|
|
|
3392
3384
|
}
|
|
3393
3385
|
}
|
|
3394
3386
|
|
|
3395
|
-
const nextLayoutId = sequentialNumberGenerator();
|
|
3387
|
+
const nextLayoutId$1 = sequentialNumberGenerator();
|
|
3396
3388
|
function toTarget(direction) {
|
|
3397
3389
|
switch (direction) {
|
|
3398
3390
|
case 'left':
|
|
@@ -3412,7 +3404,7 @@
|
|
|
3412
3404
|
constructor(_element, options) {
|
|
3413
3405
|
super();
|
|
3414
3406
|
this._element = _element;
|
|
3415
|
-
this._id = nextLayoutId.next();
|
|
3407
|
+
this._id = nextLayoutId$1.next();
|
|
3416
3408
|
this._groups = new Map();
|
|
3417
3409
|
this._onDidLayoutChange = new Emitter();
|
|
3418
3410
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
@@ -3872,6 +3864,38 @@
|
|
|
3872
3864
|
}
|
|
3873
3865
|
}
|
|
3874
3866
|
|
|
3867
|
+
const createSvgElementFromPath = (params) => {
|
|
3868
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
3869
|
+
svg.setAttributeNS(null, 'height', params.height);
|
|
3870
|
+
svg.setAttributeNS(null, 'width', params.width);
|
|
3871
|
+
svg.setAttributeNS(null, 'viewBox', params.viewbox);
|
|
3872
|
+
svg.setAttributeNS(null, 'aria-hidden', 'false');
|
|
3873
|
+
svg.setAttributeNS(null, 'focusable', 'false');
|
|
3874
|
+
svg.classList.add('dockview-svg');
|
|
3875
|
+
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
3876
|
+
path.setAttributeNS(null, 'd', params.path);
|
|
3877
|
+
svg.appendChild(path);
|
|
3878
|
+
return svg;
|
|
3879
|
+
};
|
|
3880
|
+
const createCloseButton = () => createSvgElementFromPath({
|
|
3881
|
+
width: '11',
|
|
3882
|
+
height: '11',
|
|
3883
|
+
viewbox: '0 0 28 28',
|
|
3884
|
+
path: 'M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z',
|
|
3885
|
+
});
|
|
3886
|
+
const createExpandMoreButton = () => createSvgElementFromPath({
|
|
3887
|
+
width: '11',
|
|
3888
|
+
height: '11',
|
|
3889
|
+
viewbox: '0 0 24 15',
|
|
3890
|
+
path: 'M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z',
|
|
3891
|
+
});
|
|
3892
|
+
const createChevronRightButton = () => createSvgElementFromPath({
|
|
3893
|
+
width: '11',
|
|
3894
|
+
height: '11',
|
|
3895
|
+
viewbox: '0 0 15 25',
|
|
3896
|
+
path: 'M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z',
|
|
3897
|
+
});
|
|
3898
|
+
|
|
3875
3899
|
class Watermark extends CompositeDisposable {
|
|
3876
3900
|
constructor() {
|
|
3877
3901
|
super();
|
|
@@ -3888,8 +3912,9 @@
|
|
|
3888
3912
|
const actions = new ActionContainer();
|
|
3889
3913
|
title.appendChild(emptySpace);
|
|
3890
3914
|
title.appendChild(actions.element);
|
|
3891
|
-
const closeAnchor = document.createElement('
|
|
3915
|
+
const closeAnchor = document.createElement('div');
|
|
3892
3916
|
closeAnchor.className = 'close-action';
|
|
3917
|
+
closeAnchor.appendChild(createCloseButton());
|
|
3893
3918
|
actions.add(closeAnchor);
|
|
3894
3919
|
this.addDisposables(addDisposableListener(closeAnchor, 'click', (ev) => {
|
|
3895
3920
|
var _a;
|
|
@@ -3962,6 +3987,7 @@
|
|
|
3962
3987
|
return new Component(id, componentName);
|
|
3963
3988
|
}
|
|
3964
3989
|
|
|
3990
|
+
const DEFAULT_TAB_IDENTIFIER = '__default__tab__';
|
|
3965
3991
|
class DefaultTab extends CompositeDisposable {
|
|
3966
3992
|
constructor() {
|
|
3967
3993
|
super();
|
|
@@ -3981,8 +4007,9 @@
|
|
|
3981
4007
|
this._list = document.createElement('ul');
|
|
3982
4008
|
this._list.className = 'tab-list';
|
|
3983
4009
|
//
|
|
3984
|
-
this.action = document.createElement('
|
|
4010
|
+
this.action = document.createElement('div');
|
|
3985
4011
|
this.action.className = 'tab-action';
|
|
4012
|
+
this.action.appendChild(createCloseButton());
|
|
3986
4013
|
//
|
|
3987
4014
|
this._element.appendChild(this._content);
|
|
3988
4015
|
this._element.appendChild(this._actionContainer);
|
|
@@ -3998,7 +4025,7 @@
|
|
|
3998
4025
|
return this._element;
|
|
3999
4026
|
}
|
|
4000
4027
|
get id() {
|
|
4001
|
-
return
|
|
4028
|
+
return DEFAULT_TAB_IDENTIFIER;
|
|
4002
4029
|
}
|
|
4003
4030
|
update(event) {
|
|
4004
4031
|
this.params = Object.assign(Object.assign({}, this.params), event.params);
|
|
@@ -4315,16 +4342,6 @@
|
|
|
4315
4342
|
var _a;
|
|
4316
4343
|
this._content = renderers.content;
|
|
4317
4344
|
this._tab = (_a = renderers.tab) !== null && _a !== void 0 ? _a : new DefaultTab();
|
|
4318
|
-
this._actions =
|
|
4319
|
-
renderers.actions ||
|
|
4320
|
-
(this.content.actions
|
|
4321
|
-
? {
|
|
4322
|
-
element: this.content.actions,
|
|
4323
|
-
dispose: () => {
|
|
4324
|
-
//
|
|
4325
|
-
},
|
|
4326
|
-
}
|
|
4327
|
-
: undefined);
|
|
4328
4345
|
}
|
|
4329
4346
|
get content() {
|
|
4330
4347
|
return this._content;
|
|
@@ -4332,9 +4349,6 @@
|
|
|
4332
4349
|
get tab() {
|
|
4333
4350
|
return this._tab;
|
|
4334
4351
|
}
|
|
4335
|
-
get actions() {
|
|
4336
|
-
return this._actions;
|
|
4337
|
-
}
|
|
4338
4352
|
init(params) {
|
|
4339
4353
|
this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
|
|
4340
4354
|
this.tab.init(params);
|
|
@@ -4352,16 +4366,18 @@
|
|
|
4352
4366
|
this.tab.update(event);
|
|
4353
4367
|
}
|
|
4354
4368
|
toJSON() {
|
|
4369
|
+
let tab = this.tab instanceof DefaultTab ? undefined : this.tab.toJSON();
|
|
4370
|
+
if (tab && Object.keys(tab).length === 0) {
|
|
4371
|
+
tab = undefined;
|
|
4372
|
+
}
|
|
4355
4373
|
return {
|
|
4356
4374
|
content: this.content.toJSON(),
|
|
4357
|
-
tab
|
|
4375
|
+
tab,
|
|
4358
4376
|
};
|
|
4359
4377
|
}
|
|
4360
4378
|
dispose() {
|
|
4361
|
-
var _a;
|
|
4362
4379
|
this.content.dispose();
|
|
4363
4380
|
this.tab.dispose();
|
|
4364
|
-
(_a = this.actions) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
4365
4381
|
}
|
|
4366
4382
|
}
|
|
4367
4383
|
|
|
@@ -4776,22 +4792,12 @@
|
|
|
4776
4792
|
this.moveGroupOrPanel(view, groupId, itemId, target, index);
|
|
4777
4793
|
}), view.model.onDidDrop((event) => {
|
|
4778
4794
|
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: view }));
|
|
4779
|
-
}), view.model.
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
break;
|
|
4786
|
-
case exports.GroupChangeKind2.REMOVE_PANEL:
|
|
4787
|
-
if (event.panel) {
|
|
4788
|
-
this._onDidRemovePanel.fire(event.panel);
|
|
4789
|
-
}
|
|
4790
|
-
break;
|
|
4791
|
-
case exports.GroupChangeKind2.PANEL_ACTIVE:
|
|
4792
|
-
this._onDidActivePanelChange.fire(event.panel);
|
|
4793
|
-
break;
|
|
4794
|
-
}
|
|
4795
|
+
}), view.model.onDidAddPanel((event) => {
|
|
4796
|
+
this._onDidAddPanel.fire(event.panel);
|
|
4797
|
+
}), view.model.onDidRemovePanel((event) => {
|
|
4798
|
+
this._onDidRemovePanel.fire(event.panel);
|
|
4799
|
+
}), view.model.onDidActivePanelChange((event) => {
|
|
4800
|
+
this._onDidActivePanelChange.fire(event.panel);
|
|
4795
4801
|
}));
|
|
4796
4802
|
this._groups.set(view.id, { value: view, disposable });
|
|
4797
4803
|
}
|
|
@@ -4806,7 +4812,7 @@
|
|
|
4806
4812
|
createPanel(options, group) {
|
|
4807
4813
|
const view = new DefaultGroupPanelView({
|
|
4808
4814
|
content: this.createContentComponent(options.id, options.component),
|
|
4809
|
-
tab: this.createTabComponent(options.id, options.tabComponent),
|
|
4815
|
+
tab: this.createTabComponent(options.id, options.tabComponent || this.options.defaultTabComponent),
|
|
4810
4816
|
});
|
|
4811
4817
|
const panel = new DockviewGroupPanel(options.id, this, this._api, group);
|
|
4812
4818
|
panel.init({
|
|
@@ -5559,8 +5565,9 @@
|
|
|
5559
5565
|
}
|
|
5560
5566
|
|
|
5561
5567
|
class DraggablePaneviewPanel extends PaneviewPanel {
|
|
5562
|
-
constructor(id, component, headerComponent, orientation, isExpanded, disableDnd) {
|
|
5568
|
+
constructor(accessor, id, component, headerComponent, orientation, isExpanded, disableDnd) {
|
|
5563
5569
|
super(id, component, headerComponent, orientation, isExpanded, true);
|
|
5570
|
+
this.accessor = accessor;
|
|
5564
5571
|
this._onDidDrop = new Emitter();
|
|
5565
5572
|
this.onDidDrop = this._onDidDrop.event;
|
|
5566
5573
|
if (!disableDnd) {
|
|
@@ -5572,10 +5579,11 @@
|
|
|
5572
5579
|
return;
|
|
5573
5580
|
}
|
|
5574
5581
|
const id = this.id;
|
|
5582
|
+
const accessorId = this.accessor.id;
|
|
5575
5583
|
this.header.draggable = true;
|
|
5576
5584
|
this.handler = new (class PaneDragHandler extends DragHandler {
|
|
5577
5585
|
getData() {
|
|
5578
|
-
LocalSelectionTransfer.getInstance().setData([new PaneTransfer(
|
|
5586
|
+
LocalSelectionTransfer.getInstance().setData([new PaneTransfer(accessorId, id)], PaneTransfer.prototype);
|
|
5579
5587
|
return {
|
|
5580
5588
|
dispose: () => {
|
|
5581
5589
|
LocalSelectionTransfer.getInstance().clearData(PaneTransfer.prototype);
|
|
@@ -5585,12 +5593,22 @@
|
|
|
5585
5593
|
})(this.header);
|
|
5586
5594
|
this.target = new Droptarget(this.element, {
|
|
5587
5595
|
validOverlays: 'vertical',
|
|
5588
|
-
canDisplayOverlay: () => {
|
|
5596
|
+
canDisplayOverlay: (event) => {
|
|
5589
5597
|
const data = getPaneData();
|
|
5590
|
-
if (
|
|
5591
|
-
|
|
5598
|
+
if (data) {
|
|
5599
|
+
if (data.paneId !== this.id &&
|
|
5600
|
+
data.viewId === this.accessor.id) {
|
|
5601
|
+
return true;
|
|
5602
|
+
}
|
|
5603
|
+
}
|
|
5604
|
+
if (this.accessor.options.showDndOverlay) {
|
|
5605
|
+
return this.accessor.options.showDndOverlay({
|
|
5606
|
+
nativeEvent: event,
|
|
5607
|
+
getData: getPaneData,
|
|
5608
|
+
panel: this,
|
|
5609
|
+
});
|
|
5592
5610
|
}
|
|
5593
|
-
return
|
|
5611
|
+
return false;
|
|
5594
5612
|
},
|
|
5595
5613
|
});
|
|
5596
5614
|
this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
|
|
@@ -5599,8 +5617,10 @@
|
|
|
5599
5617
|
}
|
|
5600
5618
|
onDrop(event) {
|
|
5601
5619
|
const data = getPaneData();
|
|
5602
|
-
if (!data) {
|
|
5603
|
-
|
|
5620
|
+
if (!data || data.viewId !== this.accessor.id) {
|
|
5621
|
+
// if there is no local drag event for this panel
|
|
5622
|
+
// or if the drag event was creating by another Paneview instance
|
|
5623
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData }));
|
|
5604
5624
|
return;
|
|
5605
5625
|
}
|
|
5606
5626
|
const containerApi = this._params
|
|
@@ -5608,7 +5628,8 @@
|
|
|
5608
5628
|
const panelId = data.paneId;
|
|
5609
5629
|
const existingPanel = containerApi.getPanel(panelId);
|
|
5610
5630
|
if (!existingPanel) {
|
|
5611
|
-
|
|
5631
|
+
// if the panel doesn't exist
|
|
5632
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData }));
|
|
5612
5633
|
return;
|
|
5613
5634
|
}
|
|
5614
5635
|
const allPanels = containerApi.panels;
|
|
@@ -5632,12 +5653,15 @@
|
|
|
5632
5653
|
class DefaultHeader extends CompositeDisposable {
|
|
5633
5654
|
constructor() {
|
|
5634
5655
|
super();
|
|
5656
|
+
this._expandedIcon = createExpandMoreButton();
|
|
5657
|
+
this._collapsedIcon = createChevronRightButton();
|
|
5635
5658
|
this.disposable = new MutableDisposable();
|
|
5636
5659
|
this.apiRef = { api: null };
|
|
5637
5660
|
this._element = document.createElement('div');
|
|
5638
5661
|
this.element.className = 'default-header';
|
|
5639
5662
|
this._content = document.createElement('span');
|
|
5640
|
-
this._expander = document.createElement('
|
|
5663
|
+
this._expander = document.createElement('div');
|
|
5664
|
+
this._expander.className = 'dockview-pane-header-icon';
|
|
5641
5665
|
this.element.appendChild(this._expander);
|
|
5642
5666
|
this.element.appendChild(this._content);
|
|
5643
5667
|
this.addDisposables(addDisposableListener(this._element, 'click', () => {
|
|
@@ -5651,12 +5675,32 @@
|
|
|
5651
5675
|
init(params) {
|
|
5652
5676
|
this.apiRef.api = params.api;
|
|
5653
5677
|
this._content.textContent = params.title;
|
|
5654
|
-
this.
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
toggleClass(this._expander, 'collapsed', !e.isExpanded);
|
|
5678
|
+
this.updateIcon();
|
|
5679
|
+
this.disposable.value = params.api.onDidExpansionChange(() => {
|
|
5680
|
+
this.updateIcon();
|
|
5658
5681
|
});
|
|
5659
5682
|
}
|
|
5683
|
+
updateIcon() {
|
|
5684
|
+
var _a;
|
|
5685
|
+
const isExpanded = !!((_a = this.apiRef.api) === null || _a === void 0 ? void 0 : _a.isExpanded);
|
|
5686
|
+
toggleClass(this._expander, 'collapsed', !isExpanded);
|
|
5687
|
+
if (isExpanded) {
|
|
5688
|
+
if (this._expander.contains(this._collapsedIcon)) {
|
|
5689
|
+
this._collapsedIcon.remove();
|
|
5690
|
+
}
|
|
5691
|
+
if (!this._expander.contains(this._expandedIcon)) {
|
|
5692
|
+
this._expander.appendChild(this._expandedIcon);
|
|
5693
|
+
}
|
|
5694
|
+
}
|
|
5695
|
+
else {
|
|
5696
|
+
if (this._expander.contains(this._expandedIcon)) {
|
|
5697
|
+
this._expandedIcon.remove();
|
|
5698
|
+
}
|
|
5699
|
+
if (!this._expander.contains(this._collapsedIcon)) {
|
|
5700
|
+
this._expander.appendChild(this._collapsedIcon);
|
|
5701
|
+
}
|
|
5702
|
+
}
|
|
5703
|
+
}
|
|
5660
5704
|
update(_params) {
|
|
5661
5705
|
//
|
|
5662
5706
|
}
|
|
@@ -5666,9 +5710,10 @@
|
|
|
5666
5710
|
}
|
|
5667
5711
|
}
|
|
5668
5712
|
|
|
5713
|
+
const nextLayoutId = sequentialNumberGenerator();
|
|
5669
5714
|
class PaneFramework extends DraggablePaneviewPanel {
|
|
5670
5715
|
constructor(options) {
|
|
5671
|
-
super(options.id, options.component, options.headerComponent, options.orientation, options.isExpanded, options.disableDnd);
|
|
5716
|
+
super(options.accessor, options.id, options.component, options.headerComponent, options.orientation, options.isExpanded, options.disableDnd);
|
|
5672
5717
|
this.options = options;
|
|
5673
5718
|
}
|
|
5674
5719
|
getBodyComponent() {
|
|
@@ -5682,6 +5727,7 @@
|
|
|
5682
5727
|
constructor(element, options) {
|
|
5683
5728
|
super();
|
|
5684
5729
|
this.element = element;
|
|
5730
|
+
this._id = nextLayoutId.next();
|
|
5685
5731
|
this._disposable = new MutableDisposable();
|
|
5686
5732
|
this._viewDisposables = new Map();
|
|
5687
5733
|
this._onDidLayoutfromJSON = new Emitter();
|
|
@@ -5708,6 +5754,9 @@
|
|
|
5708
5754
|
});
|
|
5709
5755
|
this.addDisposables(this._disposable);
|
|
5710
5756
|
}
|
|
5757
|
+
get id() {
|
|
5758
|
+
return this._id;
|
|
5759
|
+
}
|
|
5711
5760
|
get panels() {
|
|
5712
5761
|
return this.paneview.getPanes();
|
|
5713
5762
|
}
|
|
@@ -5772,6 +5821,7 @@
|
|
|
5772
5821
|
orientation: exports.Orientation.VERTICAL,
|
|
5773
5822
|
isExpanded: !!options.isExpanded,
|
|
5774
5823
|
disableDnd: !!this.options.disableDnd,
|
|
5824
|
+
accessor: this,
|
|
5775
5825
|
});
|
|
5776
5826
|
this.doAddPanel(view);
|
|
5777
5827
|
const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
|
|
@@ -5866,6 +5916,7 @@
|
|
|
5866
5916
|
orientation: exports.Orientation.VERTICAL,
|
|
5867
5917
|
isExpanded: !!view.expanded,
|
|
5868
5918
|
disableDnd: !!this.options.disableDnd,
|
|
5919
|
+
accessor: this,
|
|
5869
5920
|
});
|
|
5870
5921
|
this.doAddPanel(panel);
|
|
5871
5922
|
queue.push(() => {
|
|
@@ -6065,15 +6116,21 @@
|
|
|
6065
6116
|
this.component = component;
|
|
6066
6117
|
this.parameters = parameters;
|
|
6067
6118
|
this.context = context;
|
|
6119
|
+
this._initialProps = {};
|
|
6068
6120
|
this.disposed = false;
|
|
6069
6121
|
this.createPortal();
|
|
6070
6122
|
}
|
|
6071
6123
|
update(props) {
|
|
6072
|
-
var _a;
|
|
6073
6124
|
if (this.disposed) {
|
|
6074
6125
|
throw new Error('invalid operation: resource is already disposed');
|
|
6075
6126
|
}
|
|
6076
|
-
(
|
|
6127
|
+
if (!this.componentInstance) {
|
|
6128
|
+
// if the component is yet to be mounted store the props
|
|
6129
|
+
this._initialProps = Object.assign(Object.assign({}, this._initialProps), props);
|
|
6130
|
+
}
|
|
6131
|
+
else {
|
|
6132
|
+
this.componentInstance.update(props);
|
|
6133
|
+
}
|
|
6077
6134
|
}
|
|
6078
6135
|
createPortal() {
|
|
6079
6136
|
if (this.disposed) {
|
|
@@ -6093,6 +6150,10 @@
|
|
|
6093
6150
|
componentProps: this.parameters,
|
|
6094
6151
|
ref: (element) => {
|
|
6095
6152
|
this.componentInstance = element;
|
|
6153
|
+
if (Object.keys(this._initialProps).length > 0) {
|
|
6154
|
+
this.componentInstance.update(this._initialProps);
|
|
6155
|
+
this._initialProps = {}; // don't keep a reference to the users object once no longer required
|
|
6156
|
+
}
|
|
6096
6157
|
},
|
|
6097
6158
|
});
|
|
6098
6159
|
const node = this.context
|
|
@@ -6149,30 +6210,19 @@
|
|
|
6149
6210
|
this.onDidBlur = this._onDidBlur.event;
|
|
6150
6211
|
this._element = document.createElement('div');
|
|
6151
6212
|
this._element.className = 'dockview-react-part';
|
|
6152
|
-
this._actionsElement = document.createElement('div');
|
|
6153
|
-
this._actionsElement.className = 'dockview-react-part';
|
|
6154
6213
|
}
|
|
6155
6214
|
get element() {
|
|
6156
6215
|
return this._element;
|
|
6157
6216
|
}
|
|
6158
|
-
get actions() {
|
|
6159
|
-
return this._actionsElement;
|
|
6160
|
-
}
|
|
6161
6217
|
focus() {
|
|
6162
6218
|
// TODO
|
|
6163
6219
|
}
|
|
6164
6220
|
init(parameters) {
|
|
6165
|
-
const context = {
|
|
6166
|
-
api: parameters.api,
|
|
6167
|
-
containerApi: parameters.containerApi,
|
|
6168
|
-
actionsPortalElement: this._actionsElement,
|
|
6169
|
-
tabPortalElement: parameters.tab,
|
|
6170
|
-
};
|
|
6171
6221
|
this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
|
|
6172
6222
|
params: parameters.params,
|
|
6173
6223
|
api: parameters.api,
|
|
6174
6224
|
containerApi: parameters.containerApi,
|
|
6175
|
-
}
|
|
6225
|
+
});
|
|
6176
6226
|
}
|
|
6177
6227
|
toJSON() {
|
|
6178
6228
|
return {
|
|
@@ -6190,11 +6240,10 @@
|
|
|
6190
6240
|
// noop
|
|
6191
6241
|
}
|
|
6192
6242
|
dispose() {
|
|
6193
|
-
var _a
|
|
6243
|
+
var _a;
|
|
6194
6244
|
this._onDidFocus.dispose();
|
|
6195
6245
|
this._onDidBlur.dispose();
|
|
6196
6246
|
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
6197
|
-
(_b = this.actionsPart) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
6198
6247
|
}
|
|
6199
6248
|
}
|
|
6200
6249
|
|
|
@@ -6224,6 +6273,9 @@
|
|
|
6224
6273
|
(_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
|
|
6225
6274
|
}
|
|
6226
6275
|
toJSON() {
|
|
6276
|
+
if (this.id === DEFAULT_TAB_IDENTIFIER) {
|
|
6277
|
+
return {};
|
|
6278
|
+
}
|
|
6227
6279
|
return {
|
|
6228
6280
|
id: this.id,
|
|
6229
6281
|
};
|
|
@@ -6245,17 +6297,25 @@
|
|
|
6245
6297
|
this.layout = layout;
|
|
6246
6298
|
}
|
|
6247
6299
|
fromJSON(panelData, group) {
|
|
6248
|
-
var _a, _b, _c;
|
|
6300
|
+
var _a, _b, _c, _d;
|
|
6249
6301
|
const panelId = panelData.id;
|
|
6250
6302
|
const params = panelData.params;
|
|
6251
6303
|
const title = panelData.title;
|
|
6252
6304
|
const suppressClosable = panelData.suppressClosable;
|
|
6253
6305
|
const viewData = panelData.view;
|
|
6306
|
+
let tab;
|
|
6307
|
+
if ((_a = viewData.tab) === null || _a === void 0 ? void 0 : _a.id) {
|
|
6308
|
+
tab = createComponent(viewData.tab.id, viewData.tab.id, this.layout.options.tabComponents, this.layout.options.frameworkTabComponents, (_b = this.layout.options.frameworkComponentFactory) === null || _b === void 0 ? void 0 : _b.tab, () => new DefaultTab());
|
|
6309
|
+
}
|
|
6310
|
+
else if (this.layout.options.defaultTabComponent) {
|
|
6311
|
+
tab = createComponent(this.layout.options.defaultTabComponent, this.layout.options.defaultTabComponent, this.layout.options.tabComponents, this.layout.options.frameworkTabComponents, (_c = this.layout.options.frameworkComponentFactory) === null || _c === void 0 ? void 0 : _c.tab, () => new DefaultTab());
|
|
6312
|
+
}
|
|
6313
|
+
else {
|
|
6314
|
+
tab = new DefaultTab();
|
|
6315
|
+
}
|
|
6254
6316
|
const view = new DefaultGroupPanelView({
|
|
6255
|
-
content: createComponent(viewData.content.id, viewData.content.id, this.layout.options.components, this.layout.options.frameworkComponents, (
|
|
6256
|
-
tab
|
|
6257
|
-
? createComponent(viewData.tab.id, viewData.tab.id, this.layout.options.tabComponents, this.layout.options.frameworkTabComponents, (_c = this.layout.options.frameworkComponentFactory) === null || _c === void 0 ? void 0 : _c.tab)
|
|
6258
|
-
: new DefaultTab(),
|
|
6317
|
+
content: createComponent(viewData.content.id, viewData.content.id, this.layout.options.components, this.layout.options.frameworkComponents, (_d = this.layout.options.frameworkComponentFactory) === null || _d === void 0 ? void 0 : _d.content),
|
|
6318
|
+
tab,
|
|
6259
6319
|
});
|
|
6260
6320
|
const panel = new DockviewGroupPanel(panelId, this.layout, new DockviewApi(this.layout), group);
|
|
6261
6321
|
panel.init({
|
|
@@ -6323,6 +6383,80 @@
|
|
|
6323
6383
|
}
|
|
6324
6384
|
}
|
|
6325
6385
|
|
|
6386
|
+
class ReactGroupControlsRendererPart {
|
|
6387
|
+
constructor(component, reactPortalStore, _group) {
|
|
6388
|
+
this.component = component;
|
|
6389
|
+
this.reactPortalStore = reactPortalStore;
|
|
6390
|
+
this._group = _group;
|
|
6391
|
+
this.mutableDisposable = new MutableDisposable();
|
|
6392
|
+
this._element = document.createElement('div');
|
|
6393
|
+
this._element.className = 'dockview-react-part';
|
|
6394
|
+
}
|
|
6395
|
+
get element() {
|
|
6396
|
+
return this._element;
|
|
6397
|
+
}
|
|
6398
|
+
get part() {
|
|
6399
|
+
return this._part;
|
|
6400
|
+
}
|
|
6401
|
+
get group() {
|
|
6402
|
+
return this._group;
|
|
6403
|
+
}
|
|
6404
|
+
focus() {
|
|
6405
|
+
// TODO
|
|
6406
|
+
}
|
|
6407
|
+
init(parameters) {
|
|
6408
|
+
this.mutableDisposable.value = new CompositeDisposable(this._group.model.onDidAddPanel(() => {
|
|
6409
|
+
this.updatePanels();
|
|
6410
|
+
}), this._group.model.onDidRemovePanel(() => {
|
|
6411
|
+
this.updatePanels();
|
|
6412
|
+
}), this._group.model.onDidActivePanelChange(() => {
|
|
6413
|
+
this.updateActivePanel();
|
|
6414
|
+
}), parameters.api.onDidActiveChange(() => {
|
|
6415
|
+
this.updateGroupActive();
|
|
6416
|
+
}));
|
|
6417
|
+
this._part = new ReactPart(this.element, this.reactPortalStore, this.component, {
|
|
6418
|
+
api: parameters.api,
|
|
6419
|
+
containerApi: parameters.containerApi,
|
|
6420
|
+
panels: this._group.model.panels,
|
|
6421
|
+
activePanel: this._group.model.activePanel,
|
|
6422
|
+
isGroupActive: this._group.api.isActive,
|
|
6423
|
+
});
|
|
6424
|
+
}
|
|
6425
|
+
update(event) {
|
|
6426
|
+
var _a;
|
|
6427
|
+
(_a = this._part) === null || _a === void 0 ? void 0 : _a.update(event.params);
|
|
6428
|
+
}
|
|
6429
|
+
dispose() {
|
|
6430
|
+
var _a;
|
|
6431
|
+
this.mutableDisposable.dispose();
|
|
6432
|
+
(_a = this._part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
6433
|
+
}
|
|
6434
|
+
updatePanels() {
|
|
6435
|
+
this.update({ params: { panels: this._group.model.panels } });
|
|
6436
|
+
}
|
|
6437
|
+
updateActivePanel() {
|
|
6438
|
+
this.update({
|
|
6439
|
+
params: {
|
|
6440
|
+
activePanel: this._group.model.activePanel,
|
|
6441
|
+
},
|
|
6442
|
+
});
|
|
6443
|
+
}
|
|
6444
|
+
updateGroupActive() {
|
|
6445
|
+
this.update({
|
|
6446
|
+
params: {
|
|
6447
|
+
isGroupActive: this._group.api.isActive,
|
|
6448
|
+
},
|
|
6449
|
+
});
|
|
6450
|
+
}
|
|
6451
|
+
}
|
|
6452
|
+
|
|
6453
|
+
function createGroupControlElement(component, store) {
|
|
6454
|
+
return component
|
|
6455
|
+
? (groupPanel) => {
|
|
6456
|
+
return new ReactGroupControlsRendererPart(component, store, groupPanel);
|
|
6457
|
+
}
|
|
6458
|
+
: undefined;
|
|
6459
|
+
}
|
|
6326
6460
|
const DockviewReact = React__namespace.forwardRef((props, ref) => {
|
|
6327
6461
|
const domRef = React__namespace.useRef(null);
|
|
6328
6462
|
const dockviewRef = React__namespace.useRef();
|
|
@@ -6372,12 +6506,15 @@
|
|
|
6372
6506
|
const dockview = new DockviewComponent(element, {
|
|
6373
6507
|
frameworkComponentFactory: factory,
|
|
6374
6508
|
frameworkComponents: props.components,
|
|
6375
|
-
frameworkTabComponents: props.tabComponents,
|
|
6509
|
+
frameworkTabComponents: Object.assign(Object.assign({}, (props.tabComponents || {})), { [DEFAULT_TAB_IDENTIFIER]: props.defaultTabComponent }),
|
|
6376
6510
|
tabHeight: props.tabHeight,
|
|
6377
6511
|
watermarkFrameworkComponent: props.watermarkComponent,
|
|
6512
|
+
defaultTabComponent: DEFAULT_TAB_IDENTIFIER,
|
|
6378
6513
|
styles: props.hideBorders
|
|
6379
6514
|
? { separatorBorder: 'transparent' }
|
|
6380
6515
|
: undefined,
|
|
6516
|
+
showDndOverlay: props.showDndOverlay,
|
|
6517
|
+
createGroupControlElement: createGroupControlElement(props.groupControlComponent, { addPortal }),
|
|
6381
6518
|
});
|
|
6382
6519
|
(_a = domRef.current) === null || _a === void 0 ? void 0 : _a.appendChild(dockview.element);
|
|
6383
6520
|
dockview.deserializer = new ReactPanelDeserialzier(dockview);
|
|
@@ -6454,10 +6591,79 @@
|
|
|
6454
6591
|
disposable.dispose();
|
|
6455
6592
|
};
|
|
6456
6593
|
}, [props.onTabContextMenu]);
|
|
6594
|
+
React__namespace.useEffect(() => {
|
|
6595
|
+
if (!dockviewRef.current) {
|
|
6596
|
+
return;
|
|
6597
|
+
}
|
|
6598
|
+
dockviewRef.current.updateOptions({
|
|
6599
|
+
defaultTabComponent: DEFAULT_TAB_IDENTIFIER,
|
|
6600
|
+
frameworkTabComponents: Object.assign(Object.assign({}, (props.tabComponents || {})), { [DEFAULT_TAB_IDENTIFIER]: props.defaultTabComponent }),
|
|
6601
|
+
});
|
|
6602
|
+
}, [props.defaultTabComponent]);
|
|
6603
|
+
React__namespace.useEffect(() => {
|
|
6604
|
+
if (!dockviewRef.current) {
|
|
6605
|
+
return;
|
|
6606
|
+
}
|
|
6607
|
+
dockviewRef.current.updateOptions({
|
|
6608
|
+
createGroupControlElement: createGroupControlElement(props.groupControlComponent, { addPortal }),
|
|
6609
|
+
});
|
|
6610
|
+
}, [props.groupControlComponent]);
|
|
6457
6611
|
return (React__namespace.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
|
|
6458
6612
|
});
|
|
6459
6613
|
DockviewReact.displayName = 'DockviewComponent';
|
|
6460
6614
|
|
|
6615
|
+
/******************************************************************************
|
|
6616
|
+
Copyright (c) Microsoft Corporation.
|
|
6617
|
+
|
|
6618
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6619
|
+
purpose with or without fee is hereby granted.
|
|
6620
|
+
|
|
6621
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
6622
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
6623
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
6624
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
6625
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
6626
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
6627
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
6628
|
+
***************************************************************************** */
|
|
6629
|
+
|
|
6630
|
+
function __rest(s, e) {
|
|
6631
|
+
var t = {};
|
|
6632
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
6633
|
+
t[p] = s[p];
|
|
6634
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6635
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
6636
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
6637
|
+
t[p[i]] = s[p[i]];
|
|
6638
|
+
}
|
|
6639
|
+
return t;
|
|
6640
|
+
}
|
|
6641
|
+
|
|
6642
|
+
const CloseButton = () => (React__namespace.createElement("svg", { height: "11", width: "11", viewBox: "0 0 28 28", "aria-hidden": 'false', focusable: false, className: "dockview-svg" },
|
|
6643
|
+
React__namespace.createElement("path", { d: "M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z" })));
|
|
6644
|
+
|
|
6645
|
+
const DockviewDefaultTab = (_a) => {
|
|
6646
|
+
var { api, containerApi: _containerApi, params: _params } = _a, rest = __rest(_a, ["api", "containerApi", "params"]);
|
|
6647
|
+
const onClose = React__namespace.useCallback((event) => {
|
|
6648
|
+
event.stopPropagation();
|
|
6649
|
+
api.close();
|
|
6650
|
+
}, [api]);
|
|
6651
|
+
const onClick = React__namespace.useCallback((event) => {
|
|
6652
|
+
api.setActive();
|
|
6653
|
+
if (rest.onClick) {
|
|
6654
|
+
rest.onClick(event);
|
|
6655
|
+
}
|
|
6656
|
+
}, [api, rest.onClick]);
|
|
6657
|
+
const iconClassname = React__namespace.useMemo(() => {
|
|
6658
|
+
const cn = ['dockview-react-tab-action'];
|
|
6659
|
+
return cn.join(',');
|
|
6660
|
+
}, [api.suppressClosable]);
|
|
6661
|
+
return (React__namespace.createElement("div", Object.assign({}, rest, { onClick: onClick, className: "dockview-react-tab" }),
|
|
6662
|
+
React__namespace.createElement("span", { className: "dockview-react-tab-title" }, api.title),
|
|
6663
|
+
React__namespace.createElement("div", { className: iconClassname, onClick: onClose },
|
|
6664
|
+
React__namespace.createElement(CloseButton, null))));
|
|
6665
|
+
};
|
|
6666
|
+
|
|
6461
6667
|
class ReactPanelView extends SplitviewPanel {
|
|
6462
6668
|
constructor(id, component, reactComponent, reactPortalStore) {
|
|
6463
6669
|
super(id, component);
|
|
@@ -6687,6 +6893,7 @@
|
|
|
6687
6893
|
createComponent,
|
|
6688
6894
|
},
|
|
6689
6895
|
},
|
|
6896
|
+
showDndOverlay: props.showDndOverlay,
|
|
6690
6897
|
});
|
|
6691
6898
|
const api = new PaneviewApi(paneview);
|
|
6692
6899
|
const { clientWidth, clientHeight } = domRef.current;
|
|
@@ -6731,6 +6938,14 @@
|
|
|
6731
6938
|
disposable.dispose();
|
|
6732
6939
|
};
|
|
6733
6940
|
}, [props.onDidDrop]);
|
|
6941
|
+
React__namespace.useEffect(() => {
|
|
6942
|
+
if (!paneviewRef.current) {
|
|
6943
|
+
return;
|
|
6944
|
+
}
|
|
6945
|
+
paneviewRef.current.updateOptions({
|
|
6946
|
+
showDndOverlay: props.showDndOverlay,
|
|
6947
|
+
});
|
|
6948
|
+
}, [props.showDndOverlay]);
|
|
6734
6949
|
return (React__namespace.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
|
|
6735
6950
|
});
|
|
6736
6951
|
PaneviewReact.displayName = 'PaneviewComponent';
|
|
@@ -6739,6 +6954,7 @@
|
|
|
6739
6954
|
exports.ContentContainer = ContentContainer;
|
|
6740
6955
|
exports.DockviewApi = DockviewApi;
|
|
6741
6956
|
exports.DockviewComponent = DockviewComponent;
|
|
6957
|
+
exports.DockviewDefaultTab = DockviewDefaultTab;
|
|
6742
6958
|
exports.DockviewReact = DockviewReact;
|
|
6743
6959
|
exports.Gridview = Gridview;
|
|
6744
6960
|
exports.GridviewApi = GridviewApi;
|
|
@@ -6755,8 +6971,6 @@
|
|
|
6755
6971
|
exports.PaneviewComponent = PaneviewComponent;
|
|
6756
6972
|
exports.PaneviewPanel = PaneviewPanel;
|
|
6757
6973
|
exports.PaneviewReact = PaneviewReact;
|
|
6758
|
-
exports.ReactPanelContentPart = ReactPanelContentPart;
|
|
6759
|
-
exports.ReactPanelHeaderPart = ReactPanelHeaderPart;
|
|
6760
6974
|
exports.ReactPart = ReactPart;
|
|
6761
6975
|
exports.ReactPartContext = ReactPartContext;
|
|
6762
6976
|
exports.Splitview = Splitview;
|