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
|
@@ -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
|
*/
|
|
@@ -2678,6 +2678,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2678
2678
|
constructor(panelId, accessor, group) {
|
|
2679
2679
|
super();
|
|
2680
2680
|
this.panelId = panelId;
|
|
2681
|
+
this.accessor = accessor;
|
|
2681
2682
|
this.group = group;
|
|
2682
2683
|
this._onChanged = new Emitter();
|
|
2683
2684
|
this.onChanged = this._onChanged.event;
|
|
@@ -2728,7 +2729,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2728
2729
|
validOverlays: 'none',
|
|
2729
2730
|
canDisplayOverlay: (event) => {
|
|
2730
2731
|
const data = getPanelData();
|
|
2731
|
-
if (data) {
|
|
2732
|
+
if (data && this.accessor.id === data.viewId) {
|
|
2732
2733
|
return this.panelId !== data.panelId;
|
|
2733
2734
|
}
|
|
2734
2735
|
return this.group.model.canDisplayOverlay(event, exports.DockviewDropTargets.Tab);
|
|
@@ -2786,7 +2787,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2786
2787
|
canDisplayOverlay: (event) => {
|
|
2787
2788
|
var _a;
|
|
2788
2789
|
const data = getPanelData();
|
|
2789
|
-
if (data) {
|
|
2790
|
+
if (data && this.accessor.id === data.viewId) {
|
|
2790
2791
|
// don't show the overlay if the tab being dragged is the last panel of this group
|
|
2791
2792
|
return ((_a = last(this.tabs)) === null || _a === void 0 ? void 0 : _a.value.panelId) !== data.panelId;
|
|
2792
2793
|
}
|
|
@@ -2943,12 +2944,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2943
2944
|
}
|
|
2944
2945
|
}
|
|
2945
2946
|
|
|
2946
|
-
exports.GroupChangeKind2 = void 0;
|
|
2947
|
-
(function (GroupChangeKind2) {
|
|
2948
|
-
GroupChangeKind2["ADD_PANEL"] = "ADD_PANEL";
|
|
2949
|
-
GroupChangeKind2["REMOVE_PANEL"] = "REMOVE_PANEL";
|
|
2950
|
-
GroupChangeKind2["PANEL_ACTIVE"] = "PANEL_ACTIVE";
|
|
2951
|
-
})(exports.GroupChangeKind2 || (exports.GroupChangeKind2 = {}));
|
|
2952
2947
|
class Groupview extends CompositeDisposable {
|
|
2953
2948
|
constructor(container, accessor, id, options, parent) {
|
|
2954
2949
|
super();
|
|
@@ -2967,12 +2962,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2967
2962
|
this._panels = [];
|
|
2968
2963
|
this._onMove = new Emitter();
|
|
2969
2964
|
this.onMove = this._onMove.event;
|
|
2970
|
-
this._onDidGroupChange = new Emitter();
|
|
2971
|
-
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
2972
2965
|
this._onDidDrop = new Emitter();
|
|
2973
2966
|
this.onDidDrop = this._onDidDrop.event;
|
|
2967
|
+
this._onDidAddPanel = new Emitter();
|
|
2968
|
+
this.onDidAddPanel = this._onDidAddPanel.event;
|
|
2969
|
+
this._onDidRemovePanel = new Emitter();
|
|
2970
|
+
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
2971
|
+
this._onDidActivePanelChange = new Emitter();
|
|
2972
|
+
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
2974
2973
|
this.container.classList.add('groupview');
|
|
2975
|
-
this.addDisposables(this._onMove, this._onDidGroupChange, this._onDidChange, this._onDidDrop);
|
|
2976
2974
|
this.tabsContainer = new TabsContainer(this.accessor, this.parent, {
|
|
2977
2975
|
tabHeight: options.tabHeight,
|
|
2978
2976
|
});
|
|
@@ -2984,7 +2982,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2984
2982
|
return false;
|
|
2985
2983
|
}
|
|
2986
2984
|
const data = getPanelData();
|
|
2987
|
-
if (data) {
|
|
2985
|
+
if (data && data.viewId === this.accessor.id) {
|
|
2988
2986
|
const groupHasOnePanelAndIsActiveDragElement = this._panels.length === 1 && data.groupId === this.id;
|
|
2989
2987
|
return !groupHasOnePanelAndIsActiveDragElement;
|
|
2990
2988
|
}
|
|
@@ -2994,7 +2992,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2994
2992
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
2995
2993
|
this.header.hidden = !!options.hideHeader;
|
|
2996
2994
|
this.locked = !!options.locked;
|
|
2997
|
-
this.addDisposables(this._onMove, this.
|
|
2995
|
+
this.addDisposables(this._onMove, this._onDidChange, this._onDidDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this.tabsContainer.onDrop((event) => {
|
|
2998
2996
|
this.handleDropEvent(event.event, exports.Position.Center, event.index);
|
|
2999
2997
|
}), this.contentContainer.onDidFocus(() => {
|
|
3000
2998
|
this.accessor.doSetGroupActive(this.parent, true);
|
|
@@ -3066,6 +3064,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3066
3064
|
// correctly initialized
|
|
3067
3065
|
this.setActive(this.isActive, true, true);
|
|
3068
3066
|
this.updateContainer();
|
|
3067
|
+
if (this.accessor.options.createGroupControlElement) {
|
|
3068
|
+
this._control = this.accessor.options.createGroupControlElement(this.parent);
|
|
3069
|
+
this.addDisposables(this._control);
|
|
3070
|
+
this._control.init({
|
|
3071
|
+
containerApi: new DockviewApi(this.accessor),
|
|
3072
|
+
api: this.parent.api,
|
|
3073
|
+
});
|
|
3074
|
+
this.tabsContainer.setActionElement(this._control.element);
|
|
3075
|
+
}
|
|
3069
3076
|
}
|
|
3070
3077
|
indexOf(panel) {
|
|
3071
3078
|
return this.tabsContainer.indexOf(panel.id);
|
|
@@ -3196,14 +3203,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3196
3203
|
isPanelActive(panel) {
|
|
3197
3204
|
return this._activePanel === panel;
|
|
3198
3205
|
}
|
|
3199
|
-
updateActions() {
|
|
3200
|
-
|
|
3201
|
-
if (this.isActive && ((_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.actions)) {
|
|
3202
|
-
this.tabsContainer.setActionElement(this._activePanel.view.actions.element);
|
|
3203
|
-
}
|
|
3204
|
-
else {
|
|
3205
|
-
this.tabsContainer.setActionElement(undefined);
|
|
3206
|
-
}
|
|
3206
|
+
updateActions(element) {
|
|
3207
|
+
this.tabsContainer.setActionElement(element);
|
|
3207
3208
|
}
|
|
3208
3209
|
setActive(isGroupActive, skipFocus = false, force = false) {
|
|
3209
3210
|
var _a, _b;
|
|
@@ -3259,10 +3260,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3259
3260
|
if (this.mostRecentlyUsed.includes(panel)) {
|
|
3260
3261
|
this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
|
|
3261
3262
|
}
|
|
3262
|
-
this.
|
|
3263
|
-
kind: exports.GroupChangeKind2.REMOVE_PANEL,
|
|
3264
|
-
panel,
|
|
3265
|
-
});
|
|
3263
|
+
this._onDidRemovePanel.fire({ panel });
|
|
3266
3264
|
}
|
|
3267
3265
|
doAddPanel(panel, index = this.panels.length, skipSetActive = false) {
|
|
3268
3266
|
const existingPanel = this._panels.indexOf(panel);
|
|
@@ -3279,10 +3277,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3279
3277
|
}
|
|
3280
3278
|
this.updateMru(panel);
|
|
3281
3279
|
this.panels.splice(index, 0, panel);
|
|
3282
|
-
this.
|
|
3283
|
-
kind: exports.GroupChangeKind2.ADD_PANEL,
|
|
3284
|
-
panel,
|
|
3285
|
-
});
|
|
3280
|
+
this._onDidAddPanel.fire({ panel });
|
|
3286
3281
|
}
|
|
3287
3282
|
doSetActivePanel(panel) {
|
|
3288
3283
|
this._activePanel = panel;
|
|
@@ -3290,10 +3285,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3290
3285
|
this.tabsContainer.setActivePanel(panel);
|
|
3291
3286
|
panel.layout(this._width, this._height);
|
|
3292
3287
|
this.updateMru(panel);
|
|
3293
|
-
this.
|
|
3294
|
-
kind: exports.GroupChangeKind2.PANEL_ACTIVE,
|
|
3295
|
-
panel,
|
|
3296
|
-
});
|
|
3288
|
+
this._onDidActivePanelChange.fire({ panel });
|
|
3297
3289
|
}
|
|
3298
3290
|
}
|
|
3299
3291
|
updateMru(panel) {
|
|
@@ -3303,7 +3295,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3303
3295
|
this.mostRecentlyUsed = [panel, ...this.mostRecentlyUsed];
|
|
3304
3296
|
}
|
|
3305
3297
|
updateContainer() {
|
|
3306
|
-
this.updateActions();
|
|
3307
3298
|
toggleClass(this.container, 'empty', this.isEmpty);
|
|
3308
3299
|
this.panels.forEach((panel) => panel.updateParentGroup(this.parent, this.isActive));
|
|
3309
3300
|
if (this.isEmpty && !this.watermark) {
|
|
@@ -3340,6 +3331,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3340
3331
|
nativeEvent: event,
|
|
3341
3332
|
target,
|
|
3342
3333
|
group: this.accessor.getPanel(this.id),
|
|
3334
|
+
getData: getPanelData,
|
|
3343
3335
|
});
|
|
3344
3336
|
}
|
|
3345
3337
|
return false;
|
|
@@ -3388,7 +3380,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3388
3380
|
}
|
|
3389
3381
|
}
|
|
3390
3382
|
|
|
3391
|
-
const nextLayoutId = sequentialNumberGenerator();
|
|
3383
|
+
const nextLayoutId$1 = sequentialNumberGenerator();
|
|
3392
3384
|
function toTarget(direction) {
|
|
3393
3385
|
switch (direction) {
|
|
3394
3386
|
case 'left':
|
|
@@ -3408,7 +3400,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3408
3400
|
constructor(_element, options) {
|
|
3409
3401
|
super();
|
|
3410
3402
|
this._element = _element;
|
|
3411
|
-
this._id = nextLayoutId.next();
|
|
3403
|
+
this._id = nextLayoutId$1.next();
|
|
3412
3404
|
this._groups = new Map();
|
|
3413
3405
|
this._onDidLayoutChange = new Emitter();
|
|
3414
3406
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
@@ -3868,6 +3860,38 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3868
3860
|
}
|
|
3869
3861
|
}
|
|
3870
3862
|
|
|
3863
|
+
const createSvgElementFromPath = (params) => {
|
|
3864
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
3865
|
+
svg.setAttributeNS(null, 'height', params.height);
|
|
3866
|
+
svg.setAttributeNS(null, 'width', params.width);
|
|
3867
|
+
svg.setAttributeNS(null, 'viewBox', params.viewbox);
|
|
3868
|
+
svg.setAttributeNS(null, 'aria-hidden', 'false');
|
|
3869
|
+
svg.setAttributeNS(null, 'focusable', 'false');
|
|
3870
|
+
svg.classList.add('dockview-svg');
|
|
3871
|
+
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
3872
|
+
path.setAttributeNS(null, 'd', params.path);
|
|
3873
|
+
svg.appendChild(path);
|
|
3874
|
+
return svg;
|
|
3875
|
+
};
|
|
3876
|
+
const createCloseButton = () => createSvgElementFromPath({
|
|
3877
|
+
width: '11',
|
|
3878
|
+
height: '11',
|
|
3879
|
+
viewbox: '0 0 28 28',
|
|
3880
|
+
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',
|
|
3881
|
+
});
|
|
3882
|
+
const createExpandMoreButton = () => createSvgElementFromPath({
|
|
3883
|
+
width: '11',
|
|
3884
|
+
height: '11',
|
|
3885
|
+
viewbox: '0 0 24 15',
|
|
3886
|
+
path: 'M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z',
|
|
3887
|
+
});
|
|
3888
|
+
const createChevronRightButton = () => createSvgElementFromPath({
|
|
3889
|
+
width: '11',
|
|
3890
|
+
height: '11',
|
|
3891
|
+
viewbox: '0 0 15 25',
|
|
3892
|
+
path: 'M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z',
|
|
3893
|
+
});
|
|
3894
|
+
|
|
3871
3895
|
class Watermark extends CompositeDisposable {
|
|
3872
3896
|
constructor() {
|
|
3873
3897
|
super();
|
|
@@ -3884,8 +3908,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3884
3908
|
const actions = new ActionContainer();
|
|
3885
3909
|
title.appendChild(emptySpace);
|
|
3886
3910
|
title.appendChild(actions.element);
|
|
3887
|
-
const closeAnchor = document.createElement('
|
|
3911
|
+
const closeAnchor = document.createElement('div');
|
|
3888
3912
|
closeAnchor.className = 'close-action';
|
|
3913
|
+
closeAnchor.appendChild(createCloseButton());
|
|
3889
3914
|
actions.add(closeAnchor);
|
|
3890
3915
|
this.addDisposables(addDisposableListener(closeAnchor, 'click', (ev) => {
|
|
3891
3916
|
var _a;
|
|
@@ -3958,6 +3983,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3958
3983
|
return new Component(id, componentName);
|
|
3959
3984
|
}
|
|
3960
3985
|
|
|
3986
|
+
const DEFAULT_TAB_IDENTIFIER = '__default__tab__';
|
|
3961
3987
|
class DefaultTab extends CompositeDisposable {
|
|
3962
3988
|
constructor() {
|
|
3963
3989
|
super();
|
|
@@ -3977,8 +4003,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3977
4003
|
this._list = document.createElement('ul');
|
|
3978
4004
|
this._list.className = 'tab-list';
|
|
3979
4005
|
//
|
|
3980
|
-
this.action = document.createElement('
|
|
4006
|
+
this.action = document.createElement('div');
|
|
3981
4007
|
this.action.className = 'tab-action';
|
|
4008
|
+
this.action.appendChild(createCloseButton());
|
|
3982
4009
|
//
|
|
3983
4010
|
this._element.appendChild(this._content);
|
|
3984
4011
|
this._element.appendChild(this._actionContainer);
|
|
@@ -3994,7 +4021,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3994
4021
|
return this._element;
|
|
3995
4022
|
}
|
|
3996
4023
|
get id() {
|
|
3997
|
-
return
|
|
4024
|
+
return DEFAULT_TAB_IDENTIFIER;
|
|
3998
4025
|
}
|
|
3999
4026
|
update(event) {
|
|
4000
4027
|
this.params = Object.assign(Object.assign({}, this.params), event.params);
|
|
@@ -4311,16 +4338,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4311
4338
|
var _a;
|
|
4312
4339
|
this._content = renderers.content;
|
|
4313
4340
|
this._tab = (_a = renderers.tab) !== null && _a !== void 0 ? _a : new DefaultTab();
|
|
4314
|
-
this._actions =
|
|
4315
|
-
renderers.actions ||
|
|
4316
|
-
(this.content.actions
|
|
4317
|
-
? {
|
|
4318
|
-
element: this.content.actions,
|
|
4319
|
-
dispose: () => {
|
|
4320
|
-
//
|
|
4321
|
-
},
|
|
4322
|
-
}
|
|
4323
|
-
: undefined);
|
|
4324
4341
|
}
|
|
4325
4342
|
get content() {
|
|
4326
4343
|
return this._content;
|
|
@@ -4328,9 +4345,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4328
4345
|
get tab() {
|
|
4329
4346
|
return this._tab;
|
|
4330
4347
|
}
|
|
4331
|
-
get actions() {
|
|
4332
|
-
return this._actions;
|
|
4333
|
-
}
|
|
4334
4348
|
init(params) {
|
|
4335
4349
|
this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
|
|
4336
4350
|
this.tab.init(params);
|
|
@@ -4348,16 +4362,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4348
4362
|
this.tab.update(event);
|
|
4349
4363
|
}
|
|
4350
4364
|
toJSON() {
|
|
4365
|
+
let tab = this.tab instanceof DefaultTab ? undefined : this.tab.toJSON();
|
|
4366
|
+
if (tab && Object.keys(tab).length === 0) {
|
|
4367
|
+
tab = undefined;
|
|
4368
|
+
}
|
|
4351
4369
|
return {
|
|
4352
4370
|
content: this.content.toJSON(),
|
|
4353
|
-
tab
|
|
4371
|
+
tab,
|
|
4354
4372
|
};
|
|
4355
4373
|
}
|
|
4356
4374
|
dispose() {
|
|
4357
|
-
var _a;
|
|
4358
4375
|
this.content.dispose();
|
|
4359
4376
|
this.tab.dispose();
|
|
4360
|
-
(_a = this.actions) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
4361
4377
|
}
|
|
4362
4378
|
}
|
|
4363
4379
|
|
|
@@ -4772,22 +4788,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4772
4788
|
this.moveGroupOrPanel(view, groupId, itemId, target, index);
|
|
4773
4789
|
}), view.model.onDidDrop((event) => {
|
|
4774
4790
|
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api, group: view }));
|
|
4775
|
-
}), view.model.
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
break;
|
|
4782
|
-
case exports.GroupChangeKind2.REMOVE_PANEL:
|
|
4783
|
-
if (event.panel) {
|
|
4784
|
-
this._onDidRemovePanel.fire(event.panel);
|
|
4785
|
-
}
|
|
4786
|
-
break;
|
|
4787
|
-
case exports.GroupChangeKind2.PANEL_ACTIVE:
|
|
4788
|
-
this._onDidActivePanelChange.fire(event.panel);
|
|
4789
|
-
break;
|
|
4790
|
-
}
|
|
4791
|
+
}), view.model.onDidAddPanel((event) => {
|
|
4792
|
+
this._onDidAddPanel.fire(event.panel);
|
|
4793
|
+
}), view.model.onDidRemovePanel((event) => {
|
|
4794
|
+
this._onDidRemovePanel.fire(event.panel);
|
|
4795
|
+
}), view.model.onDidActivePanelChange((event) => {
|
|
4796
|
+
this._onDidActivePanelChange.fire(event.panel);
|
|
4791
4797
|
}));
|
|
4792
4798
|
this._groups.set(view.id, { value: view, disposable });
|
|
4793
4799
|
}
|
|
@@ -4802,7 +4808,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4802
4808
|
createPanel(options, group) {
|
|
4803
4809
|
const view = new DefaultGroupPanelView({
|
|
4804
4810
|
content: this.createContentComponent(options.id, options.component),
|
|
4805
|
-
tab: this.createTabComponent(options.id, options.tabComponent),
|
|
4811
|
+
tab: this.createTabComponent(options.id, options.tabComponent || this.options.defaultTabComponent),
|
|
4806
4812
|
});
|
|
4807
4813
|
const panel = new DockviewGroupPanel(options.id, this, this._api, group);
|
|
4808
4814
|
panel.init({
|
|
@@ -5555,8 +5561,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5555
5561
|
}
|
|
5556
5562
|
|
|
5557
5563
|
class DraggablePaneviewPanel extends PaneviewPanel {
|
|
5558
|
-
constructor(id, component, headerComponent, orientation, isExpanded, disableDnd) {
|
|
5564
|
+
constructor(accessor, id, component, headerComponent, orientation, isExpanded, disableDnd) {
|
|
5559
5565
|
super(id, component, headerComponent, orientation, isExpanded, true);
|
|
5566
|
+
this.accessor = accessor;
|
|
5560
5567
|
this._onDidDrop = new Emitter();
|
|
5561
5568
|
this.onDidDrop = this._onDidDrop.event;
|
|
5562
5569
|
if (!disableDnd) {
|
|
@@ -5568,10 +5575,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5568
5575
|
return;
|
|
5569
5576
|
}
|
|
5570
5577
|
const id = this.id;
|
|
5578
|
+
const accessorId = this.accessor.id;
|
|
5571
5579
|
this.header.draggable = true;
|
|
5572
5580
|
this.handler = new (class PaneDragHandler extends DragHandler {
|
|
5573
5581
|
getData() {
|
|
5574
|
-
LocalSelectionTransfer.getInstance().setData([new PaneTransfer(
|
|
5582
|
+
LocalSelectionTransfer.getInstance().setData([new PaneTransfer(accessorId, id)], PaneTransfer.prototype);
|
|
5575
5583
|
return {
|
|
5576
5584
|
dispose: () => {
|
|
5577
5585
|
LocalSelectionTransfer.getInstance().clearData(PaneTransfer.prototype);
|
|
@@ -5581,12 +5589,22 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5581
5589
|
})(this.header);
|
|
5582
5590
|
this.target = new Droptarget(this.element, {
|
|
5583
5591
|
validOverlays: 'vertical',
|
|
5584
|
-
canDisplayOverlay: () => {
|
|
5592
|
+
canDisplayOverlay: (event) => {
|
|
5585
5593
|
const data = getPaneData();
|
|
5586
|
-
if (
|
|
5587
|
-
|
|
5594
|
+
if (data) {
|
|
5595
|
+
if (data.paneId !== this.id &&
|
|
5596
|
+
data.viewId === this.accessor.id) {
|
|
5597
|
+
return true;
|
|
5598
|
+
}
|
|
5599
|
+
}
|
|
5600
|
+
if (this.accessor.options.showDndOverlay) {
|
|
5601
|
+
return this.accessor.options.showDndOverlay({
|
|
5602
|
+
nativeEvent: event,
|
|
5603
|
+
getData: getPaneData,
|
|
5604
|
+
panel: this,
|
|
5605
|
+
});
|
|
5588
5606
|
}
|
|
5589
|
-
return
|
|
5607
|
+
return false;
|
|
5590
5608
|
},
|
|
5591
5609
|
});
|
|
5592
5610
|
this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
|
|
@@ -5595,8 +5613,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5595
5613
|
}
|
|
5596
5614
|
onDrop(event) {
|
|
5597
5615
|
const data = getPaneData();
|
|
5598
|
-
if (!data) {
|
|
5599
|
-
|
|
5616
|
+
if (!data || data.viewId !== this.accessor.id) {
|
|
5617
|
+
// if there is no local drag event for this panel
|
|
5618
|
+
// or if the drag event was creating by another Paneview instance
|
|
5619
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData }));
|
|
5600
5620
|
return;
|
|
5601
5621
|
}
|
|
5602
5622
|
const containerApi = this._params
|
|
@@ -5604,7 +5624,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5604
5624
|
const panelId = data.paneId;
|
|
5605
5625
|
const existingPanel = containerApi.getPanel(panelId);
|
|
5606
5626
|
if (!existingPanel) {
|
|
5607
|
-
|
|
5627
|
+
// if the panel doesn't exist
|
|
5628
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData }));
|
|
5608
5629
|
return;
|
|
5609
5630
|
}
|
|
5610
5631
|
const allPanels = containerApi.panels;
|
|
@@ -5628,12 +5649,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5628
5649
|
class DefaultHeader extends CompositeDisposable {
|
|
5629
5650
|
constructor() {
|
|
5630
5651
|
super();
|
|
5652
|
+
this._expandedIcon = createExpandMoreButton();
|
|
5653
|
+
this._collapsedIcon = createChevronRightButton();
|
|
5631
5654
|
this.disposable = new MutableDisposable();
|
|
5632
5655
|
this.apiRef = { api: null };
|
|
5633
5656
|
this._element = document.createElement('div');
|
|
5634
5657
|
this.element.className = 'default-header';
|
|
5635
5658
|
this._content = document.createElement('span');
|
|
5636
|
-
this._expander = document.createElement('
|
|
5659
|
+
this._expander = document.createElement('div');
|
|
5660
|
+
this._expander.className = 'dockview-pane-header-icon';
|
|
5637
5661
|
this.element.appendChild(this._expander);
|
|
5638
5662
|
this.element.appendChild(this._content);
|
|
5639
5663
|
this.addDisposables(addDisposableListener(this._element, 'click', () => {
|
|
@@ -5647,12 +5671,32 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5647
5671
|
init(params) {
|
|
5648
5672
|
this.apiRef.api = params.api;
|
|
5649
5673
|
this._content.textContent = params.title;
|
|
5650
|
-
this.
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
toggleClass(this._expander, 'collapsed', !e.isExpanded);
|
|
5674
|
+
this.updateIcon();
|
|
5675
|
+
this.disposable.value = params.api.onDidExpansionChange(() => {
|
|
5676
|
+
this.updateIcon();
|
|
5654
5677
|
});
|
|
5655
5678
|
}
|
|
5679
|
+
updateIcon() {
|
|
5680
|
+
var _a;
|
|
5681
|
+
const isExpanded = !!((_a = this.apiRef.api) === null || _a === void 0 ? void 0 : _a.isExpanded);
|
|
5682
|
+
toggleClass(this._expander, 'collapsed', !isExpanded);
|
|
5683
|
+
if (isExpanded) {
|
|
5684
|
+
if (this._expander.contains(this._collapsedIcon)) {
|
|
5685
|
+
this._collapsedIcon.remove();
|
|
5686
|
+
}
|
|
5687
|
+
if (!this._expander.contains(this._expandedIcon)) {
|
|
5688
|
+
this._expander.appendChild(this._expandedIcon);
|
|
5689
|
+
}
|
|
5690
|
+
}
|
|
5691
|
+
else {
|
|
5692
|
+
if (this._expander.contains(this._expandedIcon)) {
|
|
5693
|
+
this._expandedIcon.remove();
|
|
5694
|
+
}
|
|
5695
|
+
if (!this._expander.contains(this._collapsedIcon)) {
|
|
5696
|
+
this._expander.appendChild(this._collapsedIcon);
|
|
5697
|
+
}
|
|
5698
|
+
}
|
|
5699
|
+
}
|
|
5656
5700
|
update(_params) {
|
|
5657
5701
|
//
|
|
5658
5702
|
}
|
|
@@ -5662,9 +5706,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5662
5706
|
}
|
|
5663
5707
|
}
|
|
5664
5708
|
|
|
5709
|
+
const nextLayoutId = sequentialNumberGenerator();
|
|
5665
5710
|
class PaneFramework extends DraggablePaneviewPanel {
|
|
5666
5711
|
constructor(options) {
|
|
5667
|
-
super(options.id, options.component, options.headerComponent, options.orientation, options.isExpanded, options.disableDnd);
|
|
5712
|
+
super(options.accessor, options.id, options.component, options.headerComponent, options.orientation, options.isExpanded, options.disableDnd);
|
|
5668
5713
|
this.options = options;
|
|
5669
5714
|
}
|
|
5670
5715
|
getBodyComponent() {
|
|
@@ -5678,6 +5723,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5678
5723
|
constructor(element, options) {
|
|
5679
5724
|
super();
|
|
5680
5725
|
this.element = element;
|
|
5726
|
+
this._id = nextLayoutId.next();
|
|
5681
5727
|
this._disposable = new MutableDisposable();
|
|
5682
5728
|
this._viewDisposables = new Map();
|
|
5683
5729
|
this._onDidLayoutfromJSON = new Emitter();
|
|
@@ -5704,6 +5750,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5704
5750
|
});
|
|
5705
5751
|
this.addDisposables(this._disposable);
|
|
5706
5752
|
}
|
|
5753
|
+
get id() {
|
|
5754
|
+
return this._id;
|
|
5755
|
+
}
|
|
5707
5756
|
get panels() {
|
|
5708
5757
|
return this.paneview.getPanes();
|
|
5709
5758
|
}
|
|
@@ -5768,6 +5817,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5768
5817
|
orientation: exports.Orientation.VERTICAL,
|
|
5769
5818
|
isExpanded: !!options.isExpanded,
|
|
5770
5819
|
disableDnd: !!this.options.disableDnd,
|
|
5820
|
+
accessor: this,
|
|
5771
5821
|
});
|
|
5772
5822
|
this.doAddPanel(view);
|
|
5773
5823
|
const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
|
|
@@ -5862,6 +5912,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5862
5912
|
orientation: exports.Orientation.VERTICAL,
|
|
5863
5913
|
isExpanded: !!view.expanded,
|
|
5864
5914
|
disableDnd: !!this.options.disableDnd,
|
|
5915
|
+
accessor: this,
|
|
5865
5916
|
});
|
|
5866
5917
|
this.doAddPanel(panel);
|
|
5867
5918
|
queue.push(() => {
|
|
@@ -6061,15 +6112,21 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6061
6112
|
this.component = component;
|
|
6062
6113
|
this.parameters = parameters;
|
|
6063
6114
|
this.context = context;
|
|
6115
|
+
this._initialProps = {};
|
|
6064
6116
|
this.disposed = false;
|
|
6065
6117
|
this.createPortal();
|
|
6066
6118
|
}
|
|
6067
6119
|
update(props) {
|
|
6068
|
-
var _a;
|
|
6069
6120
|
if (this.disposed) {
|
|
6070
6121
|
throw new Error('invalid operation: resource is already disposed');
|
|
6071
6122
|
}
|
|
6072
|
-
(
|
|
6123
|
+
if (!this.componentInstance) {
|
|
6124
|
+
// if the component is yet to be mounted store the props
|
|
6125
|
+
this._initialProps = Object.assign(Object.assign({}, this._initialProps), props);
|
|
6126
|
+
}
|
|
6127
|
+
else {
|
|
6128
|
+
this.componentInstance.update(props);
|
|
6129
|
+
}
|
|
6073
6130
|
}
|
|
6074
6131
|
createPortal() {
|
|
6075
6132
|
if (this.disposed) {
|
|
@@ -6089,6 +6146,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6089
6146
|
componentProps: this.parameters,
|
|
6090
6147
|
ref: (element) => {
|
|
6091
6148
|
this.componentInstance = element;
|
|
6149
|
+
if (Object.keys(this._initialProps).length > 0) {
|
|
6150
|
+
this.componentInstance.update(this._initialProps);
|
|
6151
|
+
this._initialProps = {}; // don't keep a reference to the users object once no longer required
|
|
6152
|
+
}
|
|
6092
6153
|
},
|
|
6093
6154
|
});
|
|
6094
6155
|
const node = this.context
|
|
@@ -6145,30 +6206,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6145
6206
|
this.onDidBlur = this._onDidBlur.event;
|
|
6146
6207
|
this._element = document.createElement('div');
|
|
6147
6208
|
this._element.className = 'dockview-react-part';
|
|
6148
|
-
this._actionsElement = document.createElement('div');
|
|
6149
|
-
this._actionsElement.className = 'dockview-react-part';
|
|
6150
6209
|
}
|
|
6151
6210
|
get element() {
|
|
6152
6211
|
return this._element;
|
|
6153
6212
|
}
|
|
6154
|
-
get actions() {
|
|
6155
|
-
return this._actionsElement;
|
|
6156
|
-
}
|
|
6157
6213
|
focus() {
|
|
6158
6214
|
// TODO
|
|
6159
6215
|
}
|
|
6160
6216
|
init(parameters) {
|
|
6161
|
-
const context = {
|
|
6162
|
-
api: parameters.api,
|
|
6163
|
-
containerApi: parameters.containerApi,
|
|
6164
|
-
actionsPortalElement: this._actionsElement,
|
|
6165
|
-
tabPortalElement: parameters.tab,
|
|
6166
|
-
};
|
|
6167
6217
|
this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
|
|
6168
6218
|
params: parameters.params,
|
|
6169
6219
|
api: parameters.api,
|
|
6170
6220
|
containerApi: parameters.containerApi,
|
|
6171
|
-
}
|
|
6221
|
+
});
|
|
6172
6222
|
}
|
|
6173
6223
|
toJSON() {
|
|
6174
6224
|
return {
|
|
@@ -6186,11 +6236,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6186
6236
|
// noop
|
|
6187
6237
|
}
|
|
6188
6238
|
dispose() {
|
|
6189
|
-
var _a
|
|
6239
|
+
var _a;
|
|
6190
6240
|
this._onDidFocus.dispose();
|
|
6191
6241
|
this._onDidBlur.dispose();
|
|
6192
6242
|
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
6193
|
-
(_b = this.actionsPart) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
6194
6243
|
}
|
|
6195
6244
|
}
|
|
6196
6245
|
|
|
@@ -6220,6 +6269,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6220
6269
|
(_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
|
|
6221
6270
|
}
|
|
6222
6271
|
toJSON() {
|
|
6272
|
+
if (this.id === DEFAULT_TAB_IDENTIFIER) {
|
|
6273
|
+
return {};
|
|
6274
|
+
}
|
|
6223
6275
|
return {
|
|
6224
6276
|
id: this.id,
|
|
6225
6277
|
};
|
|
@@ -6241,17 +6293,25 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6241
6293
|
this.layout = layout;
|
|
6242
6294
|
}
|
|
6243
6295
|
fromJSON(panelData, group) {
|
|
6244
|
-
var _a, _b, _c;
|
|
6296
|
+
var _a, _b, _c, _d;
|
|
6245
6297
|
const panelId = panelData.id;
|
|
6246
6298
|
const params = panelData.params;
|
|
6247
6299
|
const title = panelData.title;
|
|
6248
6300
|
const suppressClosable = panelData.suppressClosable;
|
|
6249
6301
|
const viewData = panelData.view;
|
|
6302
|
+
let tab;
|
|
6303
|
+
if ((_a = viewData.tab) === null || _a === void 0 ? void 0 : _a.id) {
|
|
6304
|
+
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());
|
|
6305
|
+
}
|
|
6306
|
+
else if (this.layout.options.defaultTabComponent) {
|
|
6307
|
+
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());
|
|
6308
|
+
}
|
|
6309
|
+
else {
|
|
6310
|
+
tab = new DefaultTab();
|
|
6311
|
+
}
|
|
6250
6312
|
const view = new DefaultGroupPanelView({
|
|
6251
|
-
content: createComponent(viewData.content.id, viewData.content.id, this.layout.options.components, this.layout.options.frameworkComponents, (
|
|
6252
|
-
tab
|
|
6253
|
-
? 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)
|
|
6254
|
-
: new DefaultTab(),
|
|
6313
|
+
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),
|
|
6314
|
+
tab,
|
|
6255
6315
|
});
|
|
6256
6316
|
const panel = new DockviewGroupPanel(panelId, this.layout, new DockviewApi(this.layout), group);
|
|
6257
6317
|
panel.init({
|
|
@@ -6319,6 +6379,80 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6319
6379
|
}
|
|
6320
6380
|
}
|
|
6321
6381
|
|
|
6382
|
+
class ReactGroupControlsRendererPart {
|
|
6383
|
+
constructor(component, reactPortalStore, _group) {
|
|
6384
|
+
this.component = component;
|
|
6385
|
+
this.reactPortalStore = reactPortalStore;
|
|
6386
|
+
this._group = _group;
|
|
6387
|
+
this.mutableDisposable = new MutableDisposable();
|
|
6388
|
+
this._element = document.createElement('div');
|
|
6389
|
+
this._element.className = 'dockview-react-part';
|
|
6390
|
+
}
|
|
6391
|
+
get element() {
|
|
6392
|
+
return this._element;
|
|
6393
|
+
}
|
|
6394
|
+
get part() {
|
|
6395
|
+
return this._part;
|
|
6396
|
+
}
|
|
6397
|
+
get group() {
|
|
6398
|
+
return this._group;
|
|
6399
|
+
}
|
|
6400
|
+
focus() {
|
|
6401
|
+
// TODO
|
|
6402
|
+
}
|
|
6403
|
+
init(parameters) {
|
|
6404
|
+
this.mutableDisposable.value = new CompositeDisposable(this._group.model.onDidAddPanel(() => {
|
|
6405
|
+
this.updatePanels();
|
|
6406
|
+
}), this._group.model.onDidRemovePanel(() => {
|
|
6407
|
+
this.updatePanels();
|
|
6408
|
+
}), this._group.model.onDidActivePanelChange(() => {
|
|
6409
|
+
this.updateActivePanel();
|
|
6410
|
+
}), parameters.api.onDidActiveChange(() => {
|
|
6411
|
+
this.updateGroupActive();
|
|
6412
|
+
}));
|
|
6413
|
+
this._part = new ReactPart(this.element, this.reactPortalStore, this.component, {
|
|
6414
|
+
api: parameters.api,
|
|
6415
|
+
containerApi: parameters.containerApi,
|
|
6416
|
+
panels: this._group.model.panels,
|
|
6417
|
+
activePanel: this._group.model.activePanel,
|
|
6418
|
+
isGroupActive: this._group.api.isActive,
|
|
6419
|
+
});
|
|
6420
|
+
}
|
|
6421
|
+
update(event) {
|
|
6422
|
+
var _a;
|
|
6423
|
+
(_a = this._part) === null || _a === void 0 ? void 0 : _a.update(event.params);
|
|
6424
|
+
}
|
|
6425
|
+
dispose() {
|
|
6426
|
+
var _a;
|
|
6427
|
+
this.mutableDisposable.dispose();
|
|
6428
|
+
(_a = this._part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
6429
|
+
}
|
|
6430
|
+
updatePanels() {
|
|
6431
|
+
this.update({ params: { panels: this._group.model.panels } });
|
|
6432
|
+
}
|
|
6433
|
+
updateActivePanel() {
|
|
6434
|
+
this.update({
|
|
6435
|
+
params: {
|
|
6436
|
+
activePanel: this._group.model.activePanel,
|
|
6437
|
+
},
|
|
6438
|
+
});
|
|
6439
|
+
}
|
|
6440
|
+
updateGroupActive() {
|
|
6441
|
+
this.update({
|
|
6442
|
+
params: {
|
|
6443
|
+
isGroupActive: this._group.api.isActive,
|
|
6444
|
+
},
|
|
6445
|
+
});
|
|
6446
|
+
}
|
|
6447
|
+
}
|
|
6448
|
+
|
|
6449
|
+
function createGroupControlElement(component, store) {
|
|
6450
|
+
return component
|
|
6451
|
+
? (groupPanel) => {
|
|
6452
|
+
return new ReactGroupControlsRendererPart(component, store, groupPanel);
|
|
6453
|
+
}
|
|
6454
|
+
: undefined;
|
|
6455
|
+
}
|
|
6322
6456
|
const DockviewReact = React__namespace.forwardRef((props, ref) => {
|
|
6323
6457
|
const domRef = React__namespace.useRef(null);
|
|
6324
6458
|
const dockviewRef = React__namespace.useRef();
|
|
@@ -6368,12 +6502,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6368
6502
|
const dockview = new DockviewComponent(element, {
|
|
6369
6503
|
frameworkComponentFactory: factory,
|
|
6370
6504
|
frameworkComponents: props.components,
|
|
6371
|
-
frameworkTabComponents: props.tabComponents,
|
|
6505
|
+
frameworkTabComponents: Object.assign(Object.assign({}, (props.tabComponents || {})), { [DEFAULT_TAB_IDENTIFIER]: props.defaultTabComponent }),
|
|
6372
6506
|
tabHeight: props.tabHeight,
|
|
6373
6507
|
watermarkFrameworkComponent: props.watermarkComponent,
|
|
6508
|
+
defaultTabComponent: DEFAULT_TAB_IDENTIFIER,
|
|
6374
6509
|
styles: props.hideBorders
|
|
6375
6510
|
? { separatorBorder: 'transparent' }
|
|
6376
6511
|
: undefined,
|
|
6512
|
+
showDndOverlay: props.showDndOverlay,
|
|
6513
|
+
createGroupControlElement: createGroupControlElement(props.groupControlComponent, { addPortal }),
|
|
6377
6514
|
});
|
|
6378
6515
|
(_a = domRef.current) === null || _a === void 0 ? void 0 : _a.appendChild(dockview.element);
|
|
6379
6516
|
dockview.deserializer = new ReactPanelDeserialzier(dockview);
|
|
@@ -6450,10 +6587,79 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6450
6587
|
disposable.dispose();
|
|
6451
6588
|
};
|
|
6452
6589
|
}, [props.onTabContextMenu]);
|
|
6590
|
+
React__namespace.useEffect(() => {
|
|
6591
|
+
if (!dockviewRef.current) {
|
|
6592
|
+
return;
|
|
6593
|
+
}
|
|
6594
|
+
dockviewRef.current.updateOptions({
|
|
6595
|
+
defaultTabComponent: DEFAULT_TAB_IDENTIFIER,
|
|
6596
|
+
frameworkTabComponents: Object.assign(Object.assign({}, (props.tabComponents || {})), { [DEFAULT_TAB_IDENTIFIER]: props.defaultTabComponent }),
|
|
6597
|
+
});
|
|
6598
|
+
}, [props.defaultTabComponent]);
|
|
6599
|
+
React__namespace.useEffect(() => {
|
|
6600
|
+
if (!dockviewRef.current) {
|
|
6601
|
+
return;
|
|
6602
|
+
}
|
|
6603
|
+
dockviewRef.current.updateOptions({
|
|
6604
|
+
createGroupControlElement: createGroupControlElement(props.groupControlComponent, { addPortal }),
|
|
6605
|
+
});
|
|
6606
|
+
}, [props.groupControlComponent]);
|
|
6453
6607
|
return (React__namespace.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
|
|
6454
6608
|
});
|
|
6455
6609
|
DockviewReact.displayName = 'DockviewComponent';
|
|
6456
6610
|
|
|
6611
|
+
/******************************************************************************
|
|
6612
|
+
Copyright (c) Microsoft Corporation.
|
|
6613
|
+
|
|
6614
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6615
|
+
purpose with or without fee is hereby granted.
|
|
6616
|
+
|
|
6617
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
6618
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
6619
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
6620
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
6621
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
6622
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
6623
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
6624
|
+
***************************************************************************** */
|
|
6625
|
+
|
|
6626
|
+
function __rest(s, e) {
|
|
6627
|
+
var t = {};
|
|
6628
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
6629
|
+
t[p] = s[p];
|
|
6630
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6631
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
6632
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
6633
|
+
t[p[i]] = s[p[i]];
|
|
6634
|
+
}
|
|
6635
|
+
return t;
|
|
6636
|
+
}
|
|
6637
|
+
|
|
6638
|
+
const CloseButton = () => (React__namespace.createElement("svg", { height: "11", width: "11", viewBox: "0 0 28 28", "aria-hidden": 'false', focusable: false, className: "dockview-svg" },
|
|
6639
|
+
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" })));
|
|
6640
|
+
|
|
6641
|
+
const DockviewDefaultTab = (_a) => {
|
|
6642
|
+
var { api, containerApi: _containerApi, params: _params } = _a, rest = __rest(_a, ["api", "containerApi", "params"]);
|
|
6643
|
+
const onClose = React__namespace.useCallback((event) => {
|
|
6644
|
+
event.stopPropagation();
|
|
6645
|
+
api.close();
|
|
6646
|
+
}, [api]);
|
|
6647
|
+
const onClick = React__namespace.useCallback((event) => {
|
|
6648
|
+
api.setActive();
|
|
6649
|
+
if (rest.onClick) {
|
|
6650
|
+
rest.onClick(event);
|
|
6651
|
+
}
|
|
6652
|
+
}, [api, rest.onClick]);
|
|
6653
|
+
const iconClassname = React__namespace.useMemo(() => {
|
|
6654
|
+
const cn = ['dockview-react-tab-action'];
|
|
6655
|
+
return cn.join(',');
|
|
6656
|
+
}, [api.suppressClosable]);
|
|
6657
|
+
return (React__namespace.createElement("div", Object.assign({}, rest, { onClick: onClick, className: "dockview-react-tab" }),
|
|
6658
|
+
React__namespace.createElement("span", { className: "dockview-react-tab-title" }, api.title),
|
|
6659
|
+
React__namespace.createElement("div", { className: iconClassname, onClick: onClose },
|
|
6660
|
+
React__namespace.createElement(CloseButton, null))));
|
|
6661
|
+
};
|
|
6662
|
+
|
|
6457
6663
|
class ReactPanelView extends SplitviewPanel {
|
|
6458
6664
|
constructor(id, component, reactComponent, reactPortalStore) {
|
|
6459
6665
|
super(id, component);
|
|
@@ -6683,6 +6889,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6683
6889
|
createComponent,
|
|
6684
6890
|
},
|
|
6685
6891
|
},
|
|
6892
|
+
showDndOverlay: props.showDndOverlay,
|
|
6686
6893
|
});
|
|
6687
6894
|
const api = new PaneviewApi(paneview);
|
|
6688
6895
|
const { clientWidth, clientHeight } = domRef.current;
|
|
@@ -6727,6 +6934,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6727
6934
|
disposable.dispose();
|
|
6728
6935
|
};
|
|
6729
6936
|
}, [props.onDidDrop]);
|
|
6937
|
+
React__namespace.useEffect(() => {
|
|
6938
|
+
if (!paneviewRef.current) {
|
|
6939
|
+
return;
|
|
6940
|
+
}
|
|
6941
|
+
paneviewRef.current.updateOptions({
|
|
6942
|
+
showDndOverlay: props.showDndOverlay,
|
|
6943
|
+
});
|
|
6944
|
+
}, [props.showDndOverlay]);
|
|
6730
6945
|
return (React__namespace.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
|
|
6731
6946
|
});
|
|
6732
6947
|
PaneviewReact.displayName = 'PaneviewComponent';
|
|
@@ -6735,6 +6950,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6735
6950
|
exports.ContentContainer = ContentContainer;
|
|
6736
6951
|
exports.DockviewApi = DockviewApi;
|
|
6737
6952
|
exports.DockviewComponent = DockviewComponent;
|
|
6953
|
+
exports.DockviewDefaultTab = DockviewDefaultTab;
|
|
6738
6954
|
exports.DockviewReact = DockviewReact;
|
|
6739
6955
|
exports.Gridview = Gridview;
|
|
6740
6956
|
exports.GridviewApi = GridviewApi;
|
|
@@ -6751,8 +6967,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6751
6967
|
exports.PaneviewComponent = PaneviewComponent;
|
|
6752
6968
|
exports.PaneviewPanel = PaneviewPanel;
|
|
6753
6969
|
exports.PaneviewReact = PaneviewReact;
|
|
6754
|
-
exports.ReactPanelContentPart = ReactPanelContentPart;
|
|
6755
|
-
exports.ReactPanelHeaderPart = ReactPanelHeaderPart;
|
|
6756
6970
|
exports.ReactPart = ReactPart;
|
|
6757
6971
|
exports.ReactPartContext = ReactPartContext;
|
|
6758
6972
|
exports.Splitview = Splitview;
|