dockview 1.10.1 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/dockview/defaultTab.d.ts +1 -1
- package/dist/cjs/dockview/defaultTab.js +11 -31
- package/dist/cjs/dockview/dockview.d.ts +1 -1
- package/dist/cjs/dockview/dockview.js +27 -47
- package/dist/cjs/dockview/headerActionsRenderer.d.ts +1 -1
- package/dist/cjs/dockview/headerActionsRenderer.js +2 -0
- package/dist/cjs/dockview/reactContentPart.d.ts +1 -1
- package/dist/cjs/dockview/reactContentPart.js +2 -0
- package/dist/cjs/dockview/reactHeaderPart.d.ts +1 -1
- package/dist/cjs/dockview/reactHeaderPart.js +2 -0
- package/dist/cjs/dockview/reactWatermarkPart.d.ts +1 -1
- package/dist/cjs/dockview/reactWatermarkPart.js +2 -0
- package/dist/cjs/gridview/gridview.d.ts +1 -1
- package/dist/cjs/gridview/gridview.js +13 -33
- package/dist/cjs/paneview/paneview.d.ts +1 -1
- package/dist/cjs/paneview/paneview.js +16 -36
- package/dist/cjs/paneview/view.d.ts +1 -1
- package/dist/cjs/react.d.ts +1 -1
- package/dist/cjs/react.js +16 -36
- package/dist/cjs/splitview/splitview.d.ts +1 -1
- package/dist/cjs/splitview/splitview.js +13 -33
- package/dist/cjs/svg.d.ts +1 -1
- package/dist/cjs/svg.js +7 -27
- package/dist/dockview.amd.js +125 -123
- package/dist/dockview.amd.js.map +1 -1
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.js.map +1 -1
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.min.noStyle.js.map +1 -1
- package/dist/dockview.amd.noStyle.js +124 -122
- package/dist/dockview.amd.noStyle.js.map +1 -1
- package/dist/dockview.cjs.js +125 -123
- package/dist/dockview.cjs.js.map +1 -1
- package/dist/dockview.esm.js +65 -43
- package/dist/dockview.esm.js.map +1 -1
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.esm.min.js.map +1 -1
- package/dist/dockview.js +125 -123
- package/dist/dockview.js.map +1 -1
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.js.map +1 -1
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.min.noStyle.js.map +1 -1
- package/dist/dockview.noStyle.js +124 -122
- package/dist/dockview.noStyle.js.map +1 -1
- package/dist/esm/dockview/defaultTab.d.ts +1 -1
- package/dist/esm/dockview/defaultTab.js +4 -4
- package/dist/esm/dockview/dockview.d.ts +1 -1
- package/dist/esm/dockview/dockview.js +1 -1
- package/dist/esm/dockview/headerActionsRenderer.d.ts +1 -1
- package/dist/esm/dockview/headerActionsRenderer.js +2 -0
- package/dist/esm/dockview/reactContentPart.d.ts +1 -1
- package/dist/esm/dockview/reactContentPart.js +2 -0
- package/dist/esm/dockview/reactHeaderPart.d.ts +1 -1
- package/dist/esm/dockview/reactHeaderPart.js +2 -0
- package/dist/esm/dockview/reactWatermarkPart.d.ts +1 -1
- package/dist/esm/dockview/reactWatermarkPart.js +2 -0
- package/dist/esm/gridview/gridview.d.ts +1 -1
- package/dist/esm/gridview/gridview.js +1 -1
- package/dist/esm/paneview/paneview.d.ts +1 -1
- package/dist/esm/paneview/paneview.js +1 -1
- package/dist/esm/paneview/view.d.ts +1 -1
- package/dist/esm/react.d.ts +1 -1
- package/dist/esm/react.js +2 -2
- package/dist/esm/splitview/splitview.d.ts +1 -1
- package/dist/esm/splitview/splitview.js +1 -1
- package/dist/esm/svg.d.ts +1 -1
- package/dist/esm/svg.js +1 -1
- package/dist/styles/dockview.css +849 -8
- package/package.json +3 -3
package/dist/dockview.noStyle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.11.0
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -10,26 +10,6 @@
|
|
|
10
10
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.dockview = {}, global.React, global.ReactDOM));
|
|
11
11
|
})(this, (function (exports, React, ReactDOM) { 'use strict';
|
|
12
12
|
|
|
13
|
-
function _interopNamespaceDefault(e) {
|
|
14
|
-
var n = Object.create(null);
|
|
15
|
-
if (e) {
|
|
16
|
-
Object.keys(e).forEach(function (k) {
|
|
17
|
-
if (k !== 'default') {
|
|
18
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () { return e[k]; }
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
n.default = e;
|
|
27
|
-
return Object.freeze(n);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
31
|
-
var ReactDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(ReactDOM);
|
|
32
|
-
|
|
33
13
|
class TransferObject {
|
|
34
14
|
}
|
|
35
15
|
class PanelTransfer extends TransferObject {
|
|
@@ -4259,6 +4239,7 @@
|
|
|
4259
4239
|
this._width = 0;
|
|
4260
4240
|
this._height = 0;
|
|
4261
4241
|
this._panels = [];
|
|
4242
|
+
this._panelDisposables = new Map();
|
|
4262
4243
|
this._onMove = new Emitter();
|
|
4263
4244
|
this.onMove = this._onMove.event;
|
|
4264
4245
|
this._onDidDrop = new Emitter();
|
|
@@ -4273,6 +4254,10 @@
|
|
|
4273
4254
|
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
4274
4255
|
this._onDidAddPanel = new Emitter();
|
|
4275
4256
|
this.onDidAddPanel = this._onDidAddPanel.event;
|
|
4257
|
+
this._onDidPanelTitleChange = new Emitter();
|
|
4258
|
+
this.onDidPanelTitleChange = this._onDidPanelTitleChange.event;
|
|
4259
|
+
this._onDidPanelParametersChange = new Emitter();
|
|
4260
|
+
this.onDidPanelParametersChange = this._onDidPanelParametersChange.event;
|
|
4276
4261
|
this._onDidRemovePanel = new Emitter();
|
|
4277
4262
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
4278
4263
|
this._onDidActivePanelChange = new Emitter();
|
|
@@ -4561,6 +4546,11 @@
|
|
|
4561
4546
|
if (this.mostRecentlyUsed.includes(panel)) {
|
|
4562
4547
|
this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
|
|
4563
4548
|
}
|
|
4549
|
+
const disposable = this._panelDisposables.get(panel.id);
|
|
4550
|
+
if (disposable) {
|
|
4551
|
+
disposable.dispose();
|
|
4552
|
+
this._panelDisposables.delete(panel.id);
|
|
4553
|
+
}
|
|
4564
4554
|
this._onDidRemovePanel.fire({ panel });
|
|
4565
4555
|
}
|
|
4566
4556
|
doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
|
|
@@ -4578,6 +4568,7 @@
|
|
|
4578
4568
|
}
|
|
4579
4569
|
this.updateMru(panel);
|
|
4580
4570
|
this.panels.splice(index, 0, panel);
|
|
4571
|
+
this._panelDisposables.set(panel.id, new CompositeDisposable(panel.api.onDidTitleChange((event) => this._onDidPanelTitleChange.fire(event)), panel.api.onDidParametersChange((event) => this._onDidPanelParametersChange.fire(event))));
|
|
4581
4572
|
this._onDidAddPanel.fire({ panel });
|
|
4582
4573
|
}
|
|
4583
4574
|
doSetActivePanel(panel) {
|
|
@@ -5001,14 +4992,16 @@
|
|
|
5001
4992
|
get height() {
|
|
5002
4993
|
return this._height;
|
|
5003
4994
|
}
|
|
5004
|
-
constructor(id) {
|
|
4995
|
+
constructor(id, component) {
|
|
5005
4996
|
super();
|
|
5006
4997
|
this.id = id;
|
|
4998
|
+
this.component = component;
|
|
5007
4999
|
this._isFocused = false;
|
|
5008
5000
|
this._isActive = false;
|
|
5009
5001
|
this._isVisible = true;
|
|
5010
5002
|
this._width = 0;
|
|
5011
5003
|
this._height = 0;
|
|
5004
|
+
this._parameters = {};
|
|
5012
5005
|
this.panelUpdatesDisposable = new MutableDisposable();
|
|
5013
5006
|
this._onDidDimensionChange = new Emitter();
|
|
5014
5007
|
this.onDidDimensionsChange = this._onDidDimensionChange.event;
|
|
@@ -5026,8 +5019,8 @@
|
|
|
5026
5019
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
5027
5020
|
this._onActiveChange = new Emitter();
|
|
5028
5021
|
this.onActiveChange = this._onActiveChange.event;
|
|
5029
|
-
this.
|
|
5030
|
-
this.
|
|
5022
|
+
this._onDidParametersChange = new Emitter();
|
|
5023
|
+
this.onDidParametersChange = this._onDidParametersChange.event;
|
|
5031
5024
|
this.addDisposables(this.onDidFocusChange((event) => {
|
|
5032
5025
|
this._isFocused = event.isFocused;
|
|
5033
5026
|
}), this.onDidActiveChange((event) => {
|
|
@@ -5037,10 +5030,14 @@
|
|
|
5037
5030
|
}), this.onDidDimensionsChange((event) => {
|
|
5038
5031
|
this._width = event.width;
|
|
5039
5032
|
this._height = event.height;
|
|
5040
|
-
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this.
|
|
5033
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onWillFocus, this._onWillVisibilityChange, this._onDidParametersChange);
|
|
5034
|
+
}
|
|
5035
|
+
getParameters() {
|
|
5036
|
+
return this._parameters;
|
|
5041
5037
|
}
|
|
5042
5038
|
initialize(panel) {
|
|
5043
|
-
this.panelUpdatesDisposable.value = this.
|
|
5039
|
+
this.panelUpdatesDisposable.value = this._onDidParametersChange.event((parameters) => {
|
|
5040
|
+
this._parameters = parameters;
|
|
5044
5041
|
panel.update({
|
|
5045
5042
|
params: parameters,
|
|
5046
5043
|
});
|
|
@@ -5053,14 +5050,14 @@
|
|
|
5053
5050
|
this._onActiveChange.fire();
|
|
5054
5051
|
}
|
|
5055
5052
|
updateParameters(parameters) {
|
|
5056
|
-
this.
|
|
5053
|
+
this._onDidParametersChange.fire(parameters);
|
|
5057
5054
|
}
|
|
5058
5055
|
}
|
|
5059
5056
|
|
|
5060
5057
|
class SplitviewPanelApiImpl extends PanelApiImpl {
|
|
5061
5058
|
//
|
|
5062
|
-
constructor(id) {
|
|
5063
|
-
super(id);
|
|
5059
|
+
constructor(id, component) {
|
|
5060
|
+
super(id, component);
|
|
5064
5061
|
this._onDidConstraintsChangeInternal = new Emitter();
|
|
5065
5062
|
this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
|
|
5066
5063
|
//
|
|
@@ -5085,8 +5082,8 @@
|
|
|
5085
5082
|
set pane(pane) {
|
|
5086
5083
|
this._pane = pane;
|
|
5087
5084
|
}
|
|
5088
|
-
constructor(id) {
|
|
5089
|
-
super(id);
|
|
5085
|
+
constructor(id, component) {
|
|
5086
|
+
super(id, component);
|
|
5090
5087
|
this._onDidExpansionChange = new Emitter({
|
|
5091
5088
|
replay: true,
|
|
5092
5089
|
});
|
|
@@ -5245,7 +5242,7 @@
|
|
|
5245
5242
|
this.header.style.display = value ? '' : 'none';
|
|
5246
5243
|
}
|
|
5247
5244
|
constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
|
|
5248
|
-
super(id, component, new PaneviewPanelApiImpl(id));
|
|
5245
|
+
super(id, component, new PaneviewPanelApiImpl(id, component));
|
|
5249
5246
|
this.headerComponent = headerComponent;
|
|
5250
5247
|
this._onDidChangeExpansionState = new Emitter({ replay: true });
|
|
5251
5248
|
this.onDidChangeExpansionState = this._onDidChangeExpansionState.event;
|
|
@@ -5476,8 +5473,8 @@
|
|
|
5476
5473
|
}
|
|
5477
5474
|
|
|
5478
5475
|
class GridviewPanelApiImpl extends PanelApiImpl {
|
|
5479
|
-
constructor(id, panel) {
|
|
5480
|
-
super(id);
|
|
5476
|
+
constructor(id, component, panel) {
|
|
5477
|
+
super(id, component);
|
|
5481
5478
|
this._onDidConstraintsChangeInternal = new Emitter();
|
|
5482
5479
|
this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
|
|
5483
5480
|
this._onDidConstraintsChange = new Emitter();
|
|
@@ -5548,7 +5545,7 @@
|
|
|
5548
5545
|
return this.api.isActive;
|
|
5549
5546
|
}
|
|
5550
5547
|
constructor(id, component, options, api) {
|
|
5551
|
-
super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id));
|
|
5548
|
+
super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id, component));
|
|
5552
5549
|
this._evaluatedMinimumWidth = 0;
|
|
5553
5550
|
this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;
|
|
5554
5551
|
this._evaluatedMinimumHeight = 0;
|
|
@@ -5656,7 +5653,7 @@
|
|
|
5656
5653
|
return this._group.model.location;
|
|
5657
5654
|
}
|
|
5658
5655
|
constructor(id, accessor) {
|
|
5659
|
-
super(id);
|
|
5656
|
+
super(id, '__dockviewgroup__');
|
|
5660
5657
|
this.accessor = accessor;
|
|
5661
5658
|
this._onDidLocationChange = new Emitter();
|
|
5662
5659
|
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
@@ -5830,8 +5827,11 @@
|
|
|
5830
5827
|
get group() {
|
|
5831
5828
|
return this._group;
|
|
5832
5829
|
}
|
|
5833
|
-
|
|
5834
|
-
|
|
5830
|
+
get tabComponent() {
|
|
5831
|
+
return this._tabComponent;
|
|
5832
|
+
}
|
|
5833
|
+
constructor(panel, group, accessor, component, tabComponent) {
|
|
5834
|
+
super(panel.id, component);
|
|
5835
5835
|
this.panel = panel;
|
|
5836
5836
|
this.accessor = accessor;
|
|
5837
5837
|
this._onDidTitleChange = new Emitter();
|
|
@@ -5845,6 +5845,7 @@
|
|
|
5845
5845
|
this._onDidLocationChange = new Emitter();
|
|
5846
5846
|
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5847
5847
|
this.groupEventsDisposable = new MutableDisposable();
|
|
5848
|
+
this._tabComponent = tabComponent;
|
|
5848
5849
|
this.initialize(panel);
|
|
5849
5850
|
this._group = group;
|
|
5850
5851
|
this.setupGroupEventListeners();
|
|
@@ -5927,7 +5928,7 @@
|
|
|
5927
5928
|
var _a;
|
|
5928
5929
|
return (_a = this._renderer) !== null && _a !== void 0 ? _a : this.accessor.renderer;
|
|
5929
5930
|
}
|
|
5930
|
-
constructor(id, accessor, containerApi, group, view, options) {
|
|
5931
|
+
constructor(id, component, tabComponent, accessor, containerApi, group, view, options) {
|
|
5931
5932
|
super();
|
|
5932
5933
|
this.id = id;
|
|
5933
5934
|
this.accessor = accessor;
|
|
@@ -5935,7 +5936,7 @@
|
|
|
5935
5936
|
this.view = view;
|
|
5936
5937
|
this._renderer = options.renderer;
|
|
5937
5938
|
this._group = group;
|
|
5938
|
-
this.api = new DockviewPanelApiImpl(this, this._group, accessor);
|
|
5939
|
+
this.api = new DockviewPanelApiImpl(this, this._group, accessor, component, tabComponent);
|
|
5939
5940
|
this.addDisposables(this.api.onActiveChange(() => {
|
|
5940
5941
|
accessor.setActivePanel(this);
|
|
5941
5942
|
}), this.api.onDidSizeChange((event) => {
|
|
@@ -6103,27 +6104,18 @@
|
|
|
6103
6104
|
//
|
|
6104
6105
|
this.params = {};
|
|
6105
6106
|
this._element = document.createElement('div');
|
|
6106
|
-
this._element.className = 'default-tab';
|
|
6107
|
+
this._element.className = 'dv-default-tab';
|
|
6107
6108
|
//
|
|
6108
6109
|
this._content = document.createElement('div');
|
|
6109
|
-
this._content.className = 'tab-content';
|
|
6110
|
-
//
|
|
6111
|
-
this._actionContainer = document.createElement('div');
|
|
6112
|
-
this._actionContainer.className = 'action-container';
|
|
6113
|
-
//
|
|
6114
|
-
this._list = document.createElement('ul');
|
|
6115
|
-
this._list.className = 'tab-list';
|
|
6116
|
-
//
|
|
6110
|
+
this._content.className = 'dv-default-tab-content';
|
|
6117
6111
|
this.action = document.createElement('div');
|
|
6118
|
-
this.action.className = 'tab-action';
|
|
6112
|
+
this.action.className = 'dv-default-tab-action';
|
|
6119
6113
|
this.action.appendChild(createCloseButton());
|
|
6120
6114
|
//
|
|
6121
6115
|
this._element.appendChild(this._content);
|
|
6122
|
-
this._element.appendChild(this.
|
|
6123
|
-
this._actionContainer.appendChild(this._list);
|
|
6124
|
-
this._list.appendChild(this.action);
|
|
6116
|
+
this._element.appendChild(this.action);
|
|
6125
6117
|
//
|
|
6126
|
-
this.addDisposables(addDisposableListener(this.
|
|
6118
|
+
this.addDisposables(addDisposableListener(this.action, 'mousedown', (ev) => {
|
|
6127
6119
|
ev.preventDefault();
|
|
6128
6120
|
}));
|
|
6129
6121
|
this.render();
|
|
@@ -6230,7 +6222,7 @@
|
|
|
6230
6222
|
? (_b = viewData.tab) === null || _b === void 0 ? void 0 : _b.id
|
|
6231
6223
|
: panelData.tabComponent;
|
|
6232
6224
|
const view = new DockviewPanelModel(this.accessor, panelId, contentComponent, tabComponent);
|
|
6233
|
-
const panel = new DockviewPanel(panelId, this.accessor, new DockviewApi(this.accessor), group, view, {
|
|
6225
|
+
const panel = new DockviewPanel(panelId, contentComponent, tabComponent, this.accessor, new DockviewApi(this.accessor), group, view, {
|
|
6234
6226
|
renderer: panelData.renderer,
|
|
6235
6227
|
});
|
|
6236
6228
|
panel.init({
|
|
@@ -8217,6 +8209,8 @@
|
|
|
8217
8209
|
if (this._onDidActivePanelChange.value !== event.panel) {
|
|
8218
8210
|
this._onDidActivePanelChange.fire(event.panel);
|
|
8219
8211
|
}
|
|
8212
|
+
}), exports.DockviewEvent.any(view.model.onDidPanelTitleChange, view.model.onDidPanelParametersChange)(() => {
|
|
8213
|
+
this._bufferOnDidLayoutChange.fire();
|
|
8220
8214
|
}));
|
|
8221
8215
|
this._groups.set(view.id, { value: view, disposable });
|
|
8222
8216
|
}
|
|
@@ -8229,7 +8223,7 @@
|
|
|
8229
8223
|
const contentComponent = options.component;
|
|
8230
8224
|
const tabComponent = (_a = options.tabComponent) !== null && _a !== void 0 ? _a : this.options.defaultTabComponent;
|
|
8231
8225
|
const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
|
|
8232
|
-
const panel = new DockviewPanel(options.id, this, this._api, group, view, { renderer: options.renderer });
|
|
8226
|
+
const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, { renderer: options.renderer });
|
|
8233
8227
|
panel.init({
|
|
8234
8228
|
title: (_b = options.title) !== null && _b !== void 0 ? _b : options.id,
|
|
8235
8229
|
params: (_c = options === null || options === void 0 ? void 0 : options.params) !== null && _c !== void 0 ? _c : {},
|
|
@@ -9144,7 +9138,7 @@
|
|
|
9144
9138
|
return this._snap;
|
|
9145
9139
|
}
|
|
9146
9140
|
constructor(id, componentName) {
|
|
9147
|
-
super(id, componentName, new SplitviewPanelApiImpl(id));
|
|
9141
|
+
super(id, componentName, new SplitviewPanelApiImpl(id, componentName));
|
|
9148
9142
|
this._evaluatedMinimumSize = 0;
|
|
9149
9143
|
this._evaluatedMaximumSize = Number.POSITIVE_INFINITY;
|
|
9150
9144
|
this._minimumSize = 0;
|
|
@@ -9224,9 +9218,9 @@
|
|
|
9224
9218
|
* component
|
|
9225
9219
|
*/
|
|
9226
9220
|
const ReactComponentBridge = (props, ref) => {
|
|
9227
|
-
const [_, triggerRender] =
|
|
9228
|
-
const _props =
|
|
9229
|
-
|
|
9221
|
+
const [_, triggerRender] = React.useState();
|
|
9222
|
+
const _props = React.useRef(props.componentProps);
|
|
9223
|
+
React.useImperativeHandle(ref, () => ({
|
|
9230
9224
|
update: (componentProps) => {
|
|
9231
9225
|
_props.current = Object.assign(Object.assign({}, _props.current), componentProps);
|
|
9232
9226
|
/**
|
|
@@ -9238,7 +9232,7 @@
|
|
|
9238
9232
|
triggerRender(Date.now());
|
|
9239
9233
|
},
|
|
9240
9234
|
}), []);
|
|
9241
|
-
return
|
|
9235
|
+
return React.createElement(props.component, _props.current);
|
|
9242
9236
|
};
|
|
9243
9237
|
ReactComponentBridge.displayName = 'DockviewReactJsBridge';
|
|
9244
9238
|
/**
|
|
@@ -9250,7 +9244,7 @@
|
|
|
9250
9244
|
let value = 1;
|
|
9251
9245
|
return { next: () => `dockview_react_portal_key_${(value++).toString()}` };
|
|
9252
9246
|
})();
|
|
9253
|
-
const ReactPartContext =
|
|
9247
|
+
const ReactPartContext = React.createContext({});
|
|
9254
9248
|
class ReactPart {
|
|
9255
9249
|
constructor(parent, portalStore, component, parameters, context) {
|
|
9256
9250
|
this.parent = parent;
|
|
@@ -9286,7 +9280,7 @@
|
|
|
9286
9280
|
*/
|
|
9287
9281
|
throw new Error('Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components');
|
|
9288
9282
|
}
|
|
9289
|
-
const bridgeComponent =
|
|
9283
|
+
const bridgeComponent = React.createElement(React.forwardRef(ReactComponentBridge), {
|
|
9290
9284
|
component: this
|
|
9291
9285
|
.component,
|
|
9292
9286
|
componentProps: this.parameters,
|
|
@@ -9299,9 +9293,9 @@
|
|
|
9299
9293
|
},
|
|
9300
9294
|
});
|
|
9301
9295
|
const node = this.context
|
|
9302
|
-
?
|
|
9296
|
+
? React.createElement(ReactPartContext.Provider, { value: this.context }, bridgeComponent)
|
|
9303
9297
|
: bridgeComponent;
|
|
9304
|
-
const portal =
|
|
9298
|
+
const portal = ReactDOM.createPortal(node, this.parent, uniquePortalKeyGenerator.next());
|
|
9305
9299
|
this.ref = {
|
|
9306
9300
|
portal,
|
|
9307
9301
|
disposable: this.portalStore.addPortal(portal),
|
|
@@ -9319,9 +9313,9 @@
|
|
|
9319
9313
|
* portal array
|
|
9320
9314
|
*/
|
|
9321
9315
|
const usePortalsLifecycle = () => {
|
|
9322
|
-
const [portals, setPortals] =
|
|
9323
|
-
|
|
9324
|
-
const addPortal =
|
|
9316
|
+
const [portals, setPortals] = React.useState([]);
|
|
9317
|
+
React.useDebugValue(`Portal count: ${portals.length}`);
|
|
9318
|
+
const addPortal = React.useCallback((portal) => {
|
|
9325
9319
|
setPortals((existingPortals) => [...existingPortals, portal]);
|
|
9326
9320
|
let disposed = false;
|
|
9327
9321
|
return {
|
|
@@ -9359,6 +9353,8 @@
|
|
|
9359
9353
|
this.onDidBlur = this._onDidBlur.event;
|
|
9360
9354
|
this._element = document.createElement('div');
|
|
9361
9355
|
this._element.className = 'dockview-react-part';
|
|
9356
|
+
this._element.style.height = '100%';
|
|
9357
|
+
this._element.style.width = '100%';
|
|
9362
9358
|
}
|
|
9363
9359
|
focus() {
|
|
9364
9360
|
// TODO
|
|
@@ -9395,6 +9391,8 @@
|
|
|
9395
9391
|
this.reactPortalStore = reactPortalStore;
|
|
9396
9392
|
this._element = document.createElement('div');
|
|
9397
9393
|
this._element.className = 'dockview-react-part';
|
|
9394
|
+
this._element.style.height = '100%';
|
|
9395
|
+
this._element.style.width = '100%';
|
|
9398
9396
|
}
|
|
9399
9397
|
focus() {
|
|
9400
9398
|
//noop
|
|
@@ -9429,6 +9427,8 @@
|
|
|
9429
9427
|
this.reactPortalStore = reactPortalStore;
|
|
9430
9428
|
this._element = document.createElement('div');
|
|
9431
9429
|
this._element.className = 'dockview-react-part';
|
|
9430
|
+
this._element.style.height = '100%';
|
|
9431
|
+
this._element.style.width = '100%';
|
|
9432
9432
|
}
|
|
9433
9433
|
init(parameters) {
|
|
9434
9434
|
this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
|
|
@@ -9480,6 +9480,8 @@
|
|
|
9480
9480
|
this.mutableDisposable = new MutableDisposable();
|
|
9481
9481
|
this._element = document.createElement('div');
|
|
9482
9482
|
this._element.className = 'dockview-react-part';
|
|
9483
|
+
this._element.style.height = '100%';
|
|
9484
|
+
this._element.style.width = '100%';
|
|
9483
9485
|
}
|
|
9484
9486
|
focus() {
|
|
9485
9487
|
// TODO
|
|
@@ -9539,12 +9541,12 @@
|
|
|
9539
9541
|
: undefined;
|
|
9540
9542
|
}
|
|
9541
9543
|
const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
|
|
9542
|
-
const DockviewReact =
|
|
9543
|
-
const domRef =
|
|
9544
|
-
const dockviewRef =
|
|
9544
|
+
const DockviewReact = React.forwardRef((props, ref) => {
|
|
9545
|
+
const domRef = React.useRef(null);
|
|
9546
|
+
const dockviewRef = React.useRef();
|
|
9545
9547
|
const [portals, addPortal] = usePortalsLifecycle();
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
+
React.useImperativeHandle(ref, () => domRef.current, []);
|
|
9549
|
+
React.useEffect(() => {
|
|
9548
9550
|
var _a;
|
|
9549
9551
|
if (!domRef.current) {
|
|
9550
9552
|
return () => {
|
|
@@ -9615,13 +9617,13 @@
|
|
|
9615
9617
|
dockview.dispose();
|
|
9616
9618
|
};
|
|
9617
9619
|
}, []);
|
|
9618
|
-
|
|
9620
|
+
React.useEffect(() => {
|
|
9619
9621
|
if (!dockviewRef.current) {
|
|
9620
9622
|
return;
|
|
9621
9623
|
}
|
|
9622
9624
|
dockviewRef.current.locked = !!props.locked;
|
|
9623
9625
|
}, [props.locked]);
|
|
9624
|
-
|
|
9626
|
+
React.useEffect(() => {
|
|
9625
9627
|
if (!dockviewRef.current) {
|
|
9626
9628
|
return;
|
|
9627
9629
|
}
|
|
@@ -9629,7 +9631,7 @@
|
|
|
9629
9631
|
disableDnd: props.disableDnd,
|
|
9630
9632
|
});
|
|
9631
9633
|
}, [props.disableDnd]);
|
|
9632
|
-
|
|
9634
|
+
React.useEffect(() => {
|
|
9633
9635
|
if (!dockviewRef.current) {
|
|
9634
9636
|
return () => {
|
|
9635
9637
|
// noop
|
|
@@ -9644,7 +9646,7 @@
|
|
|
9644
9646
|
disposable.dispose();
|
|
9645
9647
|
};
|
|
9646
9648
|
}, [props.onDidDrop]);
|
|
9647
|
-
|
|
9649
|
+
React.useEffect(() => {
|
|
9648
9650
|
if (!dockviewRef.current) {
|
|
9649
9651
|
return () => {
|
|
9650
9652
|
// noop
|
|
@@ -9659,7 +9661,7 @@
|
|
|
9659
9661
|
disposable.dispose();
|
|
9660
9662
|
};
|
|
9661
9663
|
}, [props.onWillDrop]);
|
|
9662
|
-
|
|
9664
|
+
React.useEffect(() => {
|
|
9663
9665
|
if (!dockviewRef.current) {
|
|
9664
9666
|
return;
|
|
9665
9667
|
}
|
|
@@ -9667,7 +9669,7 @@
|
|
|
9667
9669
|
frameworkComponents: props.components,
|
|
9668
9670
|
});
|
|
9669
9671
|
}, [props.components]);
|
|
9670
|
-
|
|
9672
|
+
React.useEffect(() => {
|
|
9671
9673
|
if (!dockviewRef.current) {
|
|
9672
9674
|
return;
|
|
9673
9675
|
}
|
|
@@ -9675,7 +9677,7 @@
|
|
|
9675
9677
|
floatingGroupBounds: props.floatingGroupBounds,
|
|
9676
9678
|
});
|
|
9677
9679
|
}, [props.floatingGroupBounds]);
|
|
9678
|
-
|
|
9680
|
+
React.useEffect(() => {
|
|
9679
9681
|
if (!dockviewRef.current) {
|
|
9680
9682
|
return;
|
|
9681
9683
|
}
|
|
@@ -9683,7 +9685,7 @@
|
|
|
9683
9685
|
watermarkFrameworkComponent: props.watermarkComponent,
|
|
9684
9686
|
});
|
|
9685
9687
|
}, [props.watermarkComponent]);
|
|
9686
|
-
|
|
9688
|
+
React.useEffect(() => {
|
|
9687
9689
|
if (!dockviewRef.current) {
|
|
9688
9690
|
return;
|
|
9689
9691
|
}
|
|
@@ -9691,7 +9693,7 @@
|
|
|
9691
9693
|
showDndOverlay: props.showDndOverlay,
|
|
9692
9694
|
});
|
|
9693
9695
|
}, [props.showDndOverlay]);
|
|
9694
|
-
|
|
9696
|
+
React.useEffect(() => {
|
|
9695
9697
|
if (!dockviewRef.current) {
|
|
9696
9698
|
return;
|
|
9697
9699
|
}
|
|
@@ -9699,7 +9701,7 @@
|
|
|
9699
9701
|
frameworkTabComponents: props.tabComponents,
|
|
9700
9702
|
});
|
|
9701
9703
|
}, [props.tabComponents]);
|
|
9702
|
-
|
|
9704
|
+
React.useEffect(() => {
|
|
9703
9705
|
if (!dockviewRef.current) {
|
|
9704
9706
|
return;
|
|
9705
9707
|
}
|
|
@@ -9707,7 +9709,7 @@
|
|
|
9707
9709
|
disableFloatingGroups: props.disableFloatingGroups,
|
|
9708
9710
|
});
|
|
9709
9711
|
}, [props.disableFloatingGroups]);
|
|
9710
|
-
|
|
9712
|
+
React.useEffect(() => {
|
|
9711
9713
|
var _a;
|
|
9712
9714
|
if (!dockviewRef.current) {
|
|
9713
9715
|
return;
|
|
@@ -9724,7 +9726,7 @@
|
|
|
9724
9726
|
frameworkTabComponents,
|
|
9725
9727
|
});
|
|
9726
9728
|
}, [props.defaultTabComponent]);
|
|
9727
|
-
|
|
9729
|
+
React.useEffect(() => {
|
|
9728
9730
|
if (!dockviewRef.current) {
|
|
9729
9731
|
return;
|
|
9730
9732
|
}
|
|
@@ -9732,7 +9734,7 @@
|
|
|
9732
9734
|
createRightHeaderActionsElement: createGroupControlElement(props.rightHeaderActionsComponent, { addPortal }),
|
|
9733
9735
|
});
|
|
9734
9736
|
}, [props.rightHeaderActionsComponent]);
|
|
9735
|
-
|
|
9737
|
+
React.useEffect(() => {
|
|
9736
9738
|
if (!dockviewRef.current) {
|
|
9737
9739
|
return;
|
|
9738
9740
|
}
|
|
@@ -9740,7 +9742,7 @@
|
|
|
9740
9742
|
createLeftHeaderActionsElement: createGroupControlElement(props.leftHeaderActionsComponent, { addPortal }),
|
|
9741
9743
|
});
|
|
9742
9744
|
}, [props.leftHeaderActionsComponent]);
|
|
9743
|
-
|
|
9745
|
+
React.useEffect(() => {
|
|
9744
9746
|
if (!dockviewRef.current) {
|
|
9745
9747
|
return;
|
|
9746
9748
|
}
|
|
@@ -9748,7 +9750,7 @@
|
|
|
9748
9750
|
rootOverlayModel: props.rootOverlayModel,
|
|
9749
9751
|
});
|
|
9750
9752
|
}, [props.rootOverlayModel]);
|
|
9751
|
-
|
|
9753
|
+
React.useEffect(() => {
|
|
9752
9754
|
if (!dockviewRef.current) {
|
|
9753
9755
|
return;
|
|
9754
9756
|
}
|
|
@@ -9756,7 +9758,7 @@
|
|
|
9756
9758
|
createPrefixHeaderActionsElement: createGroupControlElement(props.prefixHeaderActionsComponent, { addPortal }),
|
|
9757
9759
|
});
|
|
9758
9760
|
}, [props.prefixHeaderActionsComponent]);
|
|
9759
|
-
return (
|
|
9761
|
+
return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
|
|
9760
9762
|
});
|
|
9761
9763
|
DockviewReact.displayName = 'DockviewComponent';
|
|
9762
9764
|
|
|
@@ -9794,12 +9796,12 @@
|
|
|
9794
9796
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
9795
9797
|
};
|
|
9796
9798
|
|
|
9797
|
-
const CloseButton = () => (
|
|
9798
|
-
|
|
9799
|
+
const CloseButton = () => (React.createElement("svg", { height: "11", width: "11", viewBox: "0 0 28 28", "aria-hidden": 'false', focusable: false, className: "dockview-svg" },
|
|
9800
|
+
React.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" })));
|
|
9799
9801
|
|
|
9800
9802
|
const DockviewDefaultTab = (_a) => {
|
|
9801
9803
|
var { api, containerApi: _containerApi, params: _params, hideClose, closeActionOverride } = _a, rest = __rest(_a, ["api", "containerApi", "params", "hideClose", "closeActionOverride"]);
|
|
9802
|
-
const onClose =
|
|
9804
|
+
const onClose = React.useCallback((event) => {
|
|
9803
9805
|
event.preventDefault();
|
|
9804
9806
|
if (closeActionOverride) {
|
|
9805
9807
|
closeActionOverride();
|
|
@@ -9808,10 +9810,10 @@
|
|
|
9808
9810
|
api.close();
|
|
9809
9811
|
}
|
|
9810
9812
|
}, [api, closeActionOverride]);
|
|
9811
|
-
const onMouseDown =
|
|
9813
|
+
const onMouseDown = React.useCallback((e) => {
|
|
9812
9814
|
e.preventDefault();
|
|
9813
9815
|
}, []);
|
|
9814
|
-
const onClick =
|
|
9816
|
+
const onClick = React.useCallback((event) => {
|
|
9815
9817
|
if (event.defaultPrevented) {
|
|
9816
9818
|
return;
|
|
9817
9819
|
}
|
|
@@ -9820,10 +9822,10 @@
|
|
|
9820
9822
|
rest.onClick(event);
|
|
9821
9823
|
}
|
|
9822
9824
|
}, [api, rest.onClick]);
|
|
9823
|
-
return (
|
|
9824
|
-
|
|
9825
|
-
!hideClose && (
|
|
9826
|
-
|
|
9825
|
+
return (React.createElement("div", Object.assign({ "data-testid": "dockview-dv-default-tab" }, rest, { onClick: onClick, className: "dv-default-tab" }),
|
|
9826
|
+
React.createElement("span", { className: "dv-default-tab-content" }, api.title),
|
|
9827
|
+
!hideClose && (React.createElement("div", { className: "dv-default-tab-action", onMouseDown: onMouseDown, onClick: onClose },
|
|
9828
|
+
React.createElement(CloseButton, null)))));
|
|
9827
9829
|
};
|
|
9828
9830
|
|
|
9829
9831
|
class ReactPanelView extends SplitviewPanel {
|
|
@@ -9842,12 +9844,12 @@
|
|
|
9842
9844
|
}
|
|
9843
9845
|
}
|
|
9844
9846
|
|
|
9845
|
-
const SplitviewReact =
|
|
9846
|
-
const domRef =
|
|
9847
|
-
const splitviewRef =
|
|
9847
|
+
const SplitviewReact = React.forwardRef((props, ref) => {
|
|
9848
|
+
const domRef = React.useRef(null);
|
|
9849
|
+
const splitviewRef = React.useRef();
|
|
9848
9850
|
const [portals, addPortal] = usePortalsLifecycle();
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
+
React.useImperativeHandle(ref, () => domRef.current, []);
|
|
9852
|
+
React.useEffect(() => {
|
|
9851
9853
|
var _a;
|
|
9852
9854
|
const splitview = new SplitviewComponent({
|
|
9853
9855
|
parentElement: domRef.current,
|
|
@@ -9878,7 +9880,7 @@
|
|
|
9878
9880
|
splitview.dispose();
|
|
9879
9881
|
};
|
|
9880
9882
|
}, []);
|
|
9881
|
-
|
|
9883
|
+
React.useEffect(() => {
|
|
9882
9884
|
if (!splitviewRef.current) {
|
|
9883
9885
|
return;
|
|
9884
9886
|
}
|
|
@@ -9886,7 +9888,7 @@
|
|
|
9886
9888
|
frameworkComponents: props.components,
|
|
9887
9889
|
});
|
|
9888
9890
|
}, [props.components]);
|
|
9889
|
-
return (
|
|
9891
|
+
return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
|
|
9890
9892
|
});
|
|
9891
9893
|
SplitviewReact.displayName = 'SplitviewComponent';
|
|
9892
9894
|
|
|
@@ -9908,12 +9910,12 @@
|
|
|
9908
9910
|
}
|
|
9909
9911
|
}
|
|
9910
9912
|
|
|
9911
|
-
const GridviewReact =
|
|
9912
|
-
const domRef =
|
|
9913
|
-
const gridviewRef =
|
|
9913
|
+
const GridviewReact = React.forwardRef((props, ref) => {
|
|
9914
|
+
const domRef = React.useRef(null);
|
|
9915
|
+
const gridviewRef = React.useRef();
|
|
9914
9916
|
const [portals, addPortal] = usePortalsLifecycle();
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
+
React.useImperativeHandle(ref, () => domRef.current, []);
|
|
9918
|
+
React.useEffect(() => {
|
|
9917
9919
|
var _a;
|
|
9918
9920
|
if (!domRef.current) {
|
|
9919
9921
|
return () => {
|
|
@@ -9949,7 +9951,7 @@
|
|
|
9949
9951
|
gridview.dispose();
|
|
9950
9952
|
};
|
|
9951
9953
|
}, []);
|
|
9952
|
-
|
|
9954
|
+
React.useEffect(() => {
|
|
9953
9955
|
if (!gridviewRef.current) {
|
|
9954
9956
|
return;
|
|
9955
9957
|
}
|
|
@@ -9957,7 +9959,7 @@
|
|
|
9957
9959
|
frameworkComponents: props.components,
|
|
9958
9960
|
});
|
|
9959
9961
|
}, [props.components]);
|
|
9960
|
-
return (
|
|
9962
|
+
return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
|
|
9961
9963
|
});
|
|
9962
9964
|
GridviewReact.displayName = 'GridviewComponent';
|
|
9963
9965
|
|
|
@@ -9996,12 +9998,12 @@
|
|
|
9996
9998
|
}
|
|
9997
9999
|
}
|
|
9998
10000
|
|
|
9999
|
-
const PaneviewReact =
|
|
10000
|
-
const domRef =
|
|
10001
|
-
const paneviewRef =
|
|
10001
|
+
const PaneviewReact = React.forwardRef((props, ref) => {
|
|
10002
|
+
const domRef = React.useRef(null);
|
|
10003
|
+
const paneviewRef = React.useRef();
|
|
10002
10004
|
const [portals, addPortal] = usePortalsLifecycle();
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
+
React.useImperativeHandle(ref, () => domRef.current, []);
|
|
10006
|
+
React.useEffect(() => {
|
|
10005
10007
|
const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
|
|
10006
10008
|
addPortal,
|
|
10007
10009
|
});
|
|
@@ -10034,7 +10036,7 @@
|
|
|
10034
10036
|
paneview.dispose();
|
|
10035
10037
|
};
|
|
10036
10038
|
}, []);
|
|
10037
|
-
|
|
10039
|
+
React.useEffect(() => {
|
|
10038
10040
|
if (!paneviewRef.current) {
|
|
10039
10041
|
return;
|
|
10040
10042
|
}
|
|
@@ -10042,7 +10044,7 @@
|
|
|
10042
10044
|
frameworkComponents: props.components,
|
|
10043
10045
|
});
|
|
10044
10046
|
}, [props.components]);
|
|
10045
|
-
|
|
10047
|
+
React.useEffect(() => {
|
|
10046
10048
|
if (!paneviewRef.current) {
|
|
10047
10049
|
return;
|
|
10048
10050
|
}
|
|
@@ -10050,7 +10052,7 @@
|
|
|
10050
10052
|
headerframeworkComponents: props.headerComponents,
|
|
10051
10053
|
});
|
|
10052
10054
|
}, [props.headerComponents]);
|
|
10053
|
-
|
|
10055
|
+
React.useEffect(() => {
|
|
10054
10056
|
if (!paneviewRef.current) {
|
|
10055
10057
|
return () => {
|
|
10056
10058
|
//
|
|
@@ -10066,7 +10068,7 @@
|
|
|
10066
10068
|
disposable.dispose();
|
|
10067
10069
|
};
|
|
10068
10070
|
}, [props.onDidDrop]);
|
|
10069
|
-
|
|
10071
|
+
React.useEffect(() => {
|
|
10070
10072
|
if (!paneviewRef.current) {
|
|
10071
10073
|
return;
|
|
10072
10074
|
}
|
|
@@ -10074,7 +10076,7 @@
|
|
|
10074
10076
|
showDndOverlay: props.showDndOverlay,
|
|
10075
10077
|
});
|
|
10076
10078
|
}, [props.showDndOverlay]);
|
|
10077
|
-
return (
|
|
10079
|
+
return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
|
|
10078
10080
|
});
|
|
10079
10081
|
PaneviewReact.displayName = 'PaneviewComponent';
|
|
10080
10082
|
|