dockview 1.0.2 → 1.2.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 +243 -186
- package/dist/cjs/api/component.api.d.ts +32 -23
- package/dist/cjs/api/component.api.js +105 -34
- package/dist/cjs/api/component.api.js.map +1 -1
- package/dist/cjs/api/gridviewPanelApi.js +1 -0
- package/dist/cjs/api/gridviewPanelApi.js.map +1 -1
- package/dist/cjs/api/groupPanelApi.d.ts +11 -14
- package/dist/cjs/api/groupPanelApi.js +19 -17
- package/dist/cjs/api/groupPanelApi.js.map +1 -1
- package/dist/cjs/api/panelApi.d.ts +0 -25
- package/dist/cjs/api/panelApi.js +1 -20
- package/dist/cjs/api/panelApi.js.map +1 -1
- package/dist/cjs/api/paneviewPanelApi.js +1 -0
- package/dist/cjs/api/paneviewPanelApi.js.map +1 -1
- package/dist/cjs/api/splitviewPanelApi.d.ts +0 -1
- package/dist/cjs/api/splitviewPanelApi.js +1 -5
- package/dist/cjs/api/splitviewPanelApi.js.map +1 -1
- package/dist/cjs/dnd/abstractDragHandler.d.ts +2 -2
- package/dist/cjs/dnd/abstractDragHandler.js +14 -14
- package/dist/cjs/dnd/abstractDragHandler.js.map +1 -1
- package/dist/cjs/dnd/dataTransfer.d.ts +0 -25
- package/dist/cjs/dnd/dataTransfer.js +1 -45
- package/dist/cjs/dnd/dataTransfer.js.map +1 -1
- package/dist/cjs/dnd/dnd.d.ts +1 -14
- package/dist/cjs/dnd/dnd.js +1 -79
- package/dist/cjs/dnd/dnd.js.map +1 -1
- package/dist/cjs/dnd/droptarget.d.ts +3 -0
- package/dist/cjs/dnd/droptarget.js +69 -45
- package/dist/cjs/dnd/droptarget.js.map +1 -1
- package/dist/cjs/dockview/components/tab/defaultTab.d.ts +0 -1
- package/dist/cjs/dockview/components/tab/defaultTab.js +0 -8
- package/dist/cjs/dockview/components/tab/defaultTab.js.map +1 -1
- package/dist/cjs/dockview/deserializer.js.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts +31 -21
- package/dist/cjs/dockview/dockviewComponent.js +103 -207
- package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanel.d.ts +3 -5
- package/dist/cjs/dockview/dockviewGroupPanel.js +10 -31
- package/dist/cjs/dockview/dockviewGroupPanel.js.map +1 -1
- package/dist/cjs/dockview/options.d.ts +2 -1
- package/dist/cjs/events.js +25 -4
- package/dist/cjs/events.js.map +1 -1
- package/dist/cjs/gridview/baseComponentGridview.d.ts +12 -20
- package/dist/cjs/gridview/baseComponentGridview.js +23 -45
- package/dist/cjs/gridview/baseComponentGridview.js.map +1 -1
- package/dist/cjs/gridview/basePanelView.d.ts +5 -8
- package/dist/cjs/gridview/basePanelView.js +14 -8
- package/dist/cjs/gridview/basePanelView.js.map +1 -1
- package/dist/cjs/gridview/branchNode.js +2 -2
- package/dist/cjs/gridview/branchNode.js.map +1 -1
- package/dist/cjs/gridview/gridview.js +20 -17
- package/dist/cjs/gridview/gridview.js.map +1 -1
- package/dist/cjs/gridview/gridviewComponent.d.ts +4 -0
- package/dist/cjs/gridview/gridviewComponent.js +5 -1
- package/dist/cjs/gridview/gridviewComponent.js.map +1 -1
- package/dist/cjs/gridview/gridviewPanel.d.ts +0 -1
- package/dist/cjs/gridview/gridviewPanel.js +3 -6
- package/dist/cjs/gridview/gridviewPanel.js.map +1 -1
- package/dist/cjs/gridview/leafNode.js +2 -1
- package/dist/cjs/gridview/leafNode.js.map +1 -1
- package/dist/cjs/groupview/groupPanel.d.ts +1 -7
- package/dist/cjs/groupview/groupview.d.ts +15 -8
- package/dist/cjs/groupview/groupview.js +36 -123
- package/dist/cjs/groupview/groupview.js.map +1 -1
- package/dist/cjs/groupview/groupviewPanel.d.ts +5 -2
- package/dist/cjs/groupview/groupviewPanel.js.map +1 -1
- package/dist/cjs/groupview/panel/content.js +1 -0
- package/dist/cjs/groupview/panel/content.js.map +1 -1
- package/dist/cjs/groupview/tab.d.ts +10 -13
- package/dist/cjs/groupview/tab.js +22 -80
- package/dist/cjs/groupview/tab.js.map +1 -1
- package/dist/cjs/groupview/titlebar/tabsContainer.js +4 -6
- package/dist/cjs/groupview/titlebar/tabsContainer.js.map +1 -1
- package/dist/cjs/index.d.ts +3 -3
- package/dist/cjs/index.js +8 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lifecycle.js +2 -1
- package/dist/cjs/lifecycle.js.map +1 -1
- package/dist/cjs/panel/types.d.ts +0 -2
- package/dist/cjs/paneview/draggablePaneviewPanel.d.ts +2 -2
- package/dist/cjs/paneview/draggablePaneviewPanel.js +32 -29
- package/dist/cjs/paneview/draggablePaneviewPanel.js.map +1 -1
- package/dist/cjs/paneview/paneview.js +4 -3
- package/dist/cjs/paneview/paneview.js.map +1 -1
- package/dist/cjs/paneview/paneviewComponent.d.ts +5 -5
- package/dist/cjs/paneview/paneviewComponent.js +15 -16
- package/dist/cjs/paneview/paneviewComponent.js.map +1 -1
- package/dist/cjs/paneview/paneviewPanel.d.ts +5 -1
- package/dist/cjs/paneview/paneviewPanel.js +14 -2
- package/dist/cjs/paneview/paneviewPanel.js.map +1 -1
- package/dist/cjs/react/deserializer.js +1 -3
- package/dist/cjs/react/deserializer.js.map +1 -1
- package/dist/cjs/react/dockview/components.js +5 -1
- package/dist/cjs/react/dockview/components.js.map +1 -1
- package/dist/cjs/react/dockview/dockview.d.ts +9 -9
- package/dist/cjs/react/dockview/dockview.js +28 -2
- package/dist/cjs/react/dockview/dockview.js.map +1 -1
- package/dist/cjs/react/dockview/reactContentPart.js +4 -4
- package/dist/cjs/react/dockview/reactContentPart.js.map +1 -1
- package/dist/cjs/react/dockview/reactHeaderPart.js +1 -0
- package/dist/cjs/react/dockview/reactHeaderPart.js.map +1 -1
- package/dist/cjs/react/dockview/reactWatermarkPart.d.ts +1 -2
- package/dist/cjs/react/dockview/reactWatermarkPart.js +1 -2
- package/dist/cjs/react/dockview/reactWatermarkPart.js.map +1 -1
- package/dist/cjs/react/gridview/gridview.js +9 -2
- package/dist/cjs/react/gridview/gridview.js.map +1 -1
- package/dist/cjs/react/gridview/view.js +2 -2
- package/dist/cjs/react/gridview/view.js.map +1 -1
- package/dist/cjs/react/index.d.ts +1 -0
- package/dist/cjs/react/index.js +5 -1
- package/dist/cjs/react/index.js.map +1 -1
- package/dist/cjs/react/paneview/paneview.js +5 -1
- package/dist/cjs/react/paneview/paneview.js.map +1 -1
- package/dist/cjs/react/react.js +6 -3
- package/dist/cjs/react/react.js.map +1 -1
- package/dist/cjs/react/splitview/splitview.js +8 -2
- package/dist/cjs/react/splitview/splitview.js.map +1 -1
- package/dist/cjs/react/splitview/view.js +2 -2
- package/dist/cjs/react/splitview/view.js.map +1 -1
- package/dist/cjs/splitview/core/splitview.js +2 -2
- package/dist/cjs/splitview/core/splitview.js.map +1 -1
- package/dist/cjs/splitview/splitviewComponent.d.ts +9 -6
- package/dist/cjs/splitview/splitviewComponent.js +12 -1
- package/dist/cjs/splitview/splitviewComponent.js.map +1 -1
- package/dist/cjs/splitview/splitviewPanel.d.ts +1 -6
- package/dist/cjs/splitview/splitviewPanel.js +5 -3
- package/dist/cjs/splitview/splitviewPanel.js.map +1 -1
- package/dist/dockview.amd.js +592 -745
- package/dist/dockview.amd.min.js +2 -16
- package/dist/dockview.amd.min.noStyle.js +2 -16
- package/dist/dockview.amd.noStyle.js +591 -744
- package/dist/dockview.cjs.js +592 -745
- package/dist/dockview.esm.js +592 -734
- package/dist/dockview.esm.min.js +2 -16
- package/dist/dockview.js +592 -745
- package/dist/dockview.min.js +2 -16
- package/dist/dockview.min.noStyle.js +2 -16
- package/dist/dockview.noStyle.js +591 -744
- package/dist/esm/api/component.api.d.ts +32 -23
- package/dist/esm/api/component.api.js +51 -24
- package/dist/esm/api/gridviewPanelApi.js +1 -0
- package/dist/esm/api/groupPanelApi.d.ts +11 -14
- package/dist/esm/api/groupPanelApi.js +18 -13
- package/dist/esm/api/panelApi.d.ts +0 -25
- package/dist/esm/api/panelApi.js +1 -20
- package/dist/esm/api/paneviewPanelApi.js +1 -0
- package/dist/esm/api/splitviewPanelApi.d.ts +0 -1
- package/dist/esm/api/splitviewPanelApi.js +1 -5
- package/dist/esm/dnd/abstractDragHandler.d.ts +2 -2
- package/dist/esm/dnd/abstractDragHandler.js +9 -9
- package/dist/esm/dnd/dataTransfer.d.ts +0 -25
- package/dist/esm/dnd/dataTransfer.js +0 -40
- package/dist/esm/dnd/dnd.d.ts +1 -14
- package/dist/esm/dnd/dnd.js +1 -69
- package/dist/esm/dnd/droptarget.d.ts +3 -0
- package/dist/esm/dnd/droptarget.js +69 -45
- package/dist/esm/dockview/components/tab/defaultTab.d.ts +0 -1
- package/dist/esm/dockview/components/tab/defaultTab.js +1 -9
- package/dist/esm/dockview/dockviewComponent.d.ts +31 -21
- package/dist/esm/dockview/dockviewComponent.js +68 -148
- package/dist/esm/dockview/dockviewGroupPanel.d.ts +3 -5
- package/dist/esm/dockview/dockviewGroupPanel.js +6 -30
- package/dist/esm/dockview/options.d.ts +2 -1
- package/dist/esm/events.js +2 -3
- package/dist/esm/gridview/baseComponentGridview.d.ts +12 -20
- package/dist/esm/gridview/baseComponentGridview.js +23 -45
- package/dist/esm/gridview/basePanelView.d.ts +5 -8
- package/dist/esm/gridview/basePanelView.js +10 -8
- package/dist/esm/gridview/branchNode.js +2 -2
- package/dist/esm/gridview/gridview.js +17 -15
- package/dist/esm/gridview/gridviewComponent.d.ts +4 -0
- package/dist/esm/gridview/gridviewComponent.js +6 -2
- package/dist/esm/gridview/gridviewPanel.d.ts +0 -1
- package/dist/esm/gridview/gridviewPanel.js +3 -6
- package/dist/esm/gridview/leafNode.js +1 -0
- package/dist/esm/groupview/groupPanel.d.ts +1 -7
- package/dist/esm/groupview/groupview.d.ts +15 -8
- package/dist/esm/groupview/groupview.js +22 -56
- package/dist/esm/groupview/groupviewPanel.d.ts +5 -2
- package/dist/esm/groupview/panel/content.js +1 -0
- package/dist/esm/groupview/tab.d.ts +10 -13
- package/dist/esm/groupview/tab.js +17 -24
- package/dist/esm/groupview/titlebar/tabsContainer.js +4 -6
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.js +1 -2
- package/dist/esm/lifecycle.js +2 -1
- package/dist/esm/panel/types.d.ts +0 -2
- package/dist/esm/paneview/draggablePaneviewPanel.d.ts +2 -2
- package/dist/esm/paneview/draggablePaneviewPanel.js +32 -29
- package/dist/esm/paneview/paneview.js +2 -2
- package/dist/esm/paneview/paneviewComponent.d.ts +5 -5
- package/dist/esm/paneview/paneviewComponent.js +15 -8
- package/dist/esm/paneview/paneviewPanel.d.ts +5 -1
- package/dist/esm/paneview/paneviewPanel.js +10 -2
- package/dist/esm/react/deserializer.js +1 -3
- package/dist/esm/react/dockview/dockview.d.ts +9 -9
- package/dist/esm/react/dockview/dockview.js +24 -2
- package/dist/esm/react/dockview/reactContentPart.js +4 -4
- package/dist/esm/react/dockview/reactHeaderPart.js +1 -0
- package/dist/esm/react/dockview/reactWatermarkPart.d.ts +1 -2
- package/dist/esm/react/dockview/reactWatermarkPart.js +1 -2
- package/dist/esm/react/gridview/gridview.js +4 -1
- package/dist/esm/react/gridview/view.js +2 -2
- package/dist/esm/react/index.d.ts +1 -0
- package/dist/esm/react/react.js +1 -2
- package/dist/esm/react/splitview/splitview.js +3 -1
- package/dist/esm/react/splitview/view.js +2 -2
- package/dist/esm/splitview/core/splitview.js +2 -2
- package/dist/esm/splitview/splitviewComponent.d.ts +9 -6
- package/dist/esm/splitview/splitviewComponent.js +11 -2
- package/dist/esm/splitview/splitviewPanel.d.ts +1 -6
- package/dist/esm/splitview/splitviewPanel.js +5 -3
- package/dist/styles/dockview.css +51 -54
- package/package.json +11 -11
- package/dist/cjs/functions.d.ts +0 -1
- package/dist/cjs/functions.js +0 -42
- package/dist/cjs/functions.js.map +0 -1
- package/dist/cjs/groupview/panel/hostedPanel.d.ts +0 -22
- package/dist/cjs/groupview/panel/hostedPanel.js +0 -57
- package/dist/cjs/groupview/panel/hostedPanel.js.map +0 -1
- package/dist/cjs/json.d.ts +0 -1
- package/dist/cjs/json.js +0 -14
- package/dist/cjs/json.js.map +0 -1
- package/dist/esm/functions.d.ts +0 -1
- package/dist/esm/functions.js +0 -8
- package/dist/esm/groupview/panel/hostedPanel.d.ts +0 -22
- package/dist/esm/groupview/panel/hostedPanel.js +0 -43
- package/dist/esm/json.d.ts +0 -1
- package/dist/esm/json.js +0 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 1.0
|
|
3
|
+
* @version 1.2.0
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -27,6 +27,76 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
27
27
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
28
28
|
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
29
29
|
|
|
30
|
+
class TransferObject {
|
|
31
|
+
constructor() {
|
|
32
|
+
//
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
class PanelTransfer extends TransferObject {
|
|
36
|
+
constructor(viewId, groupId, panelId) {
|
|
37
|
+
super();
|
|
38
|
+
this.viewId = viewId;
|
|
39
|
+
this.groupId = groupId;
|
|
40
|
+
this.panelId = panelId;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
class PaneTransfer extends TransferObject {
|
|
44
|
+
constructor(viewId, paneId) {
|
|
45
|
+
super();
|
|
46
|
+
this.viewId = viewId;
|
|
47
|
+
this.paneId = paneId;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A singleton to store transfer data during drag & drop operations that are only valid within the application.
|
|
52
|
+
*/
|
|
53
|
+
class LocalSelectionTransfer {
|
|
54
|
+
constructor() {
|
|
55
|
+
// protect against external instantiation
|
|
56
|
+
}
|
|
57
|
+
static getInstance() {
|
|
58
|
+
return LocalSelectionTransfer.INSTANCE;
|
|
59
|
+
}
|
|
60
|
+
hasData(proto) {
|
|
61
|
+
return proto && proto === this.proto;
|
|
62
|
+
}
|
|
63
|
+
clearData(proto) {
|
|
64
|
+
if (this.hasData(proto)) {
|
|
65
|
+
this.proto = undefined;
|
|
66
|
+
this.data = undefined;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
getData(proto) {
|
|
70
|
+
if (this.hasData(proto)) {
|
|
71
|
+
return this.data;
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
setData(data, proto) {
|
|
76
|
+
if (proto) {
|
|
77
|
+
this.data = data;
|
|
78
|
+
this.proto = proto;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
LocalSelectionTransfer.INSTANCE = new LocalSelectionTransfer();
|
|
83
|
+
function getPanelData() {
|
|
84
|
+
const panelTransfer = LocalSelectionTransfer.getInstance();
|
|
85
|
+
const isPanelEvent = panelTransfer.hasData(PanelTransfer.prototype);
|
|
86
|
+
if (!isPanelEvent) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
return panelTransfer.getData(PanelTransfer.prototype)[0];
|
|
90
|
+
}
|
|
91
|
+
function getPaneData() {
|
|
92
|
+
const paneTransfer = LocalSelectionTransfer.getInstance();
|
|
93
|
+
const isPanelEvent = paneTransfer.hasData(PaneTransfer.prototype);
|
|
94
|
+
if (!isPanelEvent) {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
return paneTransfer.getData(PaneTransfer.prototype)[0];
|
|
98
|
+
}
|
|
99
|
+
|
|
30
100
|
exports.Event = void 0;
|
|
31
101
|
(function (Event) {
|
|
32
102
|
Event.any = (...children) => {
|
|
@@ -57,7 +127,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
57
127
|
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) && this._last !== undefined) {
|
|
58
128
|
listener(this._last);
|
|
59
129
|
}
|
|
60
|
-
this._listeners.length === 0;
|
|
61
130
|
this._listeners.push(listener);
|
|
62
131
|
return {
|
|
63
132
|
dispose: () => {
|
|
@@ -73,9 +142,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
73
142
|
}
|
|
74
143
|
fire(e) {
|
|
75
144
|
this._last = e;
|
|
76
|
-
this._listeners
|
|
145
|
+
for (const listener of this._listeners) {
|
|
77
146
|
listener(e);
|
|
78
|
-
}
|
|
147
|
+
}
|
|
79
148
|
}
|
|
80
149
|
dispose() {
|
|
81
150
|
this._listeners = [];
|
|
@@ -117,164 +186,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
117
186
|
}
|
|
118
187
|
}
|
|
119
188
|
|
|
120
|
-
exports.Disposable = void 0;
|
|
121
|
-
(function (Disposable) {
|
|
122
|
-
Disposable.NONE = {
|
|
123
|
-
dispose: () => {
|
|
124
|
-
// noop
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
})(exports.Disposable || (exports.Disposable = {}));
|
|
128
|
-
class CompositeDisposable {
|
|
129
|
-
constructor(...args) {
|
|
130
|
-
this.disposables = args;
|
|
131
|
-
}
|
|
132
|
-
static from(...args) {
|
|
133
|
-
return new CompositeDisposable(...args);
|
|
134
|
-
}
|
|
135
|
-
addDisposables(...args) {
|
|
136
|
-
args === null || args === void 0 ? void 0 : args.forEach((arg) => this.disposables.push(arg));
|
|
137
|
-
}
|
|
138
|
-
dispose() {
|
|
139
|
-
this.disposables.forEach((arg) => arg.dispose());
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
class MutableDisposable {
|
|
143
|
-
constructor() {
|
|
144
|
-
this._disposable = exports.Disposable.NONE;
|
|
145
|
-
}
|
|
146
|
-
set value(disposable) {
|
|
147
|
-
if (this._disposable) {
|
|
148
|
-
this._disposable.dispose();
|
|
149
|
-
}
|
|
150
|
-
this._disposable = disposable;
|
|
151
|
-
}
|
|
152
|
-
dispose() {
|
|
153
|
-
if (this._disposable) {
|
|
154
|
-
this._disposable.dispose();
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function tryParseJSON(text, reviver) {
|
|
160
|
-
try {
|
|
161
|
-
return JSON.parse(text, reviver);
|
|
162
|
-
}
|
|
163
|
-
catch (err) {
|
|
164
|
-
console.warn('failed to parse JSON');
|
|
165
|
-
return undefined;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
class TransferObject {
|
|
170
|
-
constructor() {
|
|
171
|
-
//
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
class PanelTransfer extends TransferObject {
|
|
175
|
-
constructor(viewId, groupId, panelId) {
|
|
176
|
-
super();
|
|
177
|
-
this.viewId = viewId;
|
|
178
|
-
this.groupId = groupId;
|
|
179
|
-
this.panelId = panelId;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
class PaneTransfer extends TransferObject {
|
|
183
|
-
constructor(viewId, paneId) {
|
|
184
|
-
super();
|
|
185
|
-
this.viewId = viewId;
|
|
186
|
-
this.paneId = paneId;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
const DATA_KEY = 'splitview/transfer';
|
|
190
|
-
const isPanelTransferEvent = (event) => {
|
|
191
|
-
if (!event.dataTransfer) {
|
|
192
|
-
return false;
|
|
193
|
-
}
|
|
194
|
-
return event.dataTransfer.types.includes(DATA_KEY);
|
|
195
|
-
};
|
|
196
|
-
exports.DragType = void 0;
|
|
197
|
-
(function (DragType) {
|
|
198
|
-
DragType["DOCKVIEW_TAB"] = "dockview_tab";
|
|
199
|
-
DragType["EXTERNAL"] = "external_group_drag";
|
|
200
|
-
})(exports.DragType || (exports.DragType = {}));
|
|
201
|
-
/**
|
|
202
|
-
* Determine whether this data belong to that of an event that was started by
|
|
203
|
-
* dragging a tab component
|
|
204
|
-
*/
|
|
205
|
-
const isTabDragEvent = (data) => {
|
|
206
|
-
return data.type === exports.DragType.DOCKVIEW_TAB;
|
|
207
|
-
};
|
|
208
|
-
/**
|
|
209
|
-
* Determine whether this data belong to that of an event that was started by
|
|
210
|
-
* a custom drag-enable component
|
|
211
|
-
*/
|
|
212
|
-
const isCustomDragEvent = (data) => {
|
|
213
|
-
return data.type === exports.DragType.EXTERNAL;
|
|
214
|
-
};
|
|
215
|
-
const extractData = (event) => {
|
|
216
|
-
if (!event.dataTransfer) {
|
|
217
|
-
return null;
|
|
218
|
-
}
|
|
219
|
-
const data = tryParseJSON(event.dataTransfer.getData(DATA_KEY));
|
|
220
|
-
if (!data) {
|
|
221
|
-
console.warn(`[dragEvent] ${DATA_KEY} data is missing`);
|
|
222
|
-
}
|
|
223
|
-
if (typeof data.type !== 'string') {
|
|
224
|
-
console.warn(`[dragEvent] invalid type ${data.type}`);
|
|
225
|
-
}
|
|
226
|
-
return data;
|
|
227
|
-
};
|
|
228
|
-
/**
|
|
229
|
-
* A singleton to store transfer data during drag & drop operations that are only valid within the application.
|
|
230
|
-
*/
|
|
231
|
-
class LocalSelectionTransfer {
|
|
232
|
-
constructor() {
|
|
233
|
-
// protect against external instantiation
|
|
234
|
-
}
|
|
235
|
-
static getInstance() {
|
|
236
|
-
return LocalSelectionTransfer.INSTANCE;
|
|
237
|
-
}
|
|
238
|
-
hasData(proto) {
|
|
239
|
-
return proto && proto === this.proto;
|
|
240
|
-
}
|
|
241
|
-
clearData(proto) {
|
|
242
|
-
if (this.hasData(proto)) {
|
|
243
|
-
this.proto = undefined;
|
|
244
|
-
this.data = undefined;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
getData(proto) {
|
|
248
|
-
if (this.hasData(proto)) {
|
|
249
|
-
return this.data;
|
|
250
|
-
}
|
|
251
|
-
return undefined;
|
|
252
|
-
}
|
|
253
|
-
setData(data, proto) {
|
|
254
|
-
if (proto) {
|
|
255
|
-
this.data = data;
|
|
256
|
-
this.proto = proto;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
LocalSelectionTransfer.INSTANCE = new LocalSelectionTransfer();
|
|
261
|
-
function getPanelData() {
|
|
262
|
-
const panelTransfer = LocalSelectionTransfer.getInstance();
|
|
263
|
-
const isPanelEvent = panelTransfer.hasData(PanelTransfer.prototype);
|
|
264
|
-
if (!isPanelEvent) {
|
|
265
|
-
return undefined;
|
|
266
|
-
}
|
|
267
|
-
return panelTransfer.getData(PanelTransfer.prototype)[0];
|
|
268
|
-
}
|
|
269
|
-
function getPaneData() {
|
|
270
|
-
const paneTransfer = LocalSelectionTransfer.getInstance();
|
|
271
|
-
const isPanelEvent = paneTransfer.hasData(PaneTransfer.prototype);
|
|
272
|
-
if (!isPanelEvent) {
|
|
273
|
-
return undefined;
|
|
274
|
-
}
|
|
275
|
-
return paneTransfer.getData(PaneTransfer.prototype)[0];
|
|
276
|
-
}
|
|
277
|
-
|
|
278
189
|
class SplitviewApi {
|
|
279
190
|
constructor(component) {
|
|
280
191
|
this.component = component;
|
|
@@ -294,11 +205,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
294
205
|
get length() {
|
|
295
206
|
return this.component.length;
|
|
296
207
|
}
|
|
208
|
+
get orientation() {
|
|
209
|
+
return this.component.orientation;
|
|
210
|
+
}
|
|
297
211
|
get onDidLayoutChange() {
|
|
298
212
|
return this.component.onDidLayoutChange;
|
|
299
213
|
}
|
|
300
|
-
get
|
|
301
|
-
return this.component.
|
|
214
|
+
get onDidAddView() {
|
|
215
|
+
return this.component.onDidAddView;
|
|
216
|
+
}
|
|
217
|
+
get onDidRemoveView() {
|
|
218
|
+
return this.component.onDidRemoveView;
|
|
302
219
|
}
|
|
303
220
|
updateOptions(options) {
|
|
304
221
|
this.component.updateOptions(options);
|
|
@@ -344,18 +261,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
344
261
|
constructor(component) {
|
|
345
262
|
this.component = component;
|
|
346
263
|
}
|
|
347
|
-
get width() {
|
|
348
|
-
return this.component.width;
|
|
349
|
-
}
|
|
350
|
-
get height() {
|
|
351
|
-
return this.component.height;
|
|
352
|
-
}
|
|
353
264
|
get minimumSize() {
|
|
354
265
|
return this.component.minimumSize;
|
|
355
266
|
}
|
|
356
267
|
get maximumSize() {
|
|
357
268
|
return this.component.maximumSize;
|
|
358
269
|
}
|
|
270
|
+
get height() {
|
|
271
|
+
return this.component.height;
|
|
272
|
+
}
|
|
273
|
+
get width() {
|
|
274
|
+
return this.component.width;
|
|
275
|
+
}
|
|
359
276
|
get onDidLayoutChange() {
|
|
360
277
|
return this.component.onDidLayoutChange;
|
|
361
278
|
}
|
|
@@ -411,12 +328,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
411
328
|
constructor(component) {
|
|
412
329
|
this.component = component;
|
|
413
330
|
}
|
|
414
|
-
get width() {
|
|
415
|
-
return this.component.width;
|
|
416
|
-
}
|
|
417
|
-
get height() {
|
|
418
|
-
return this.component.height;
|
|
419
|
-
}
|
|
420
331
|
get minimumHeight() {
|
|
421
332
|
return this.component.minimumHeight;
|
|
422
333
|
}
|
|
@@ -429,12 +340,27 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
429
340
|
get maximumWidth() {
|
|
430
341
|
return this.component.maximumWidth;
|
|
431
342
|
}
|
|
432
|
-
get
|
|
433
|
-
return this.component.
|
|
343
|
+
get width() {
|
|
344
|
+
return this.component.width;
|
|
345
|
+
}
|
|
346
|
+
get height() {
|
|
347
|
+
return this.component.height;
|
|
434
348
|
}
|
|
435
349
|
get onDidLayoutChange() {
|
|
436
350
|
return this.component.onDidLayoutChange;
|
|
437
351
|
}
|
|
352
|
+
get onDidAddGroup() {
|
|
353
|
+
return this.component.onDidAddGroup;
|
|
354
|
+
}
|
|
355
|
+
get onDidRemoveGroup() {
|
|
356
|
+
return this.component.onDidRemoveGroup;
|
|
357
|
+
}
|
|
358
|
+
get onDidActiveGroupChange() {
|
|
359
|
+
return this.component.onDidActiveGroupChange;
|
|
360
|
+
}
|
|
361
|
+
get onDidLayoutFromJSON() {
|
|
362
|
+
return this.component.onDidLayoutFromJSON;
|
|
363
|
+
}
|
|
438
364
|
get panels() {
|
|
439
365
|
return this.component.groups;
|
|
440
366
|
}
|
|
@@ -509,8 +435,26 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
509
435
|
get totalPanels() {
|
|
510
436
|
return this.component.totalPanels;
|
|
511
437
|
}
|
|
512
|
-
get
|
|
513
|
-
return this.component.
|
|
438
|
+
get onDidActiveGroupChange() {
|
|
439
|
+
return this.component.onDidActiveGroupChange;
|
|
440
|
+
}
|
|
441
|
+
get onDidAddGroup() {
|
|
442
|
+
return this.component.onDidAddGroup;
|
|
443
|
+
}
|
|
444
|
+
get onDidRemoveGroup() {
|
|
445
|
+
return this.component.onDidRemoveGroup;
|
|
446
|
+
}
|
|
447
|
+
get onDidActivePanelChange() {
|
|
448
|
+
return this.component.onDidActivePanelChange;
|
|
449
|
+
}
|
|
450
|
+
get onDidAddPanel() {
|
|
451
|
+
return this.component.onDidAddPanel;
|
|
452
|
+
}
|
|
453
|
+
get onDidRemovePanel() {
|
|
454
|
+
return this.component.onDidRemovePanel;
|
|
455
|
+
}
|
|
456
|
+
get onDidLayoutfromJSON() {
|
|
457
|
+
return this.component.onDidLayoutfromJSON;
|
|
514
458
|
}
|
|
515
459
|
get onDidLayoutChange() {
|
|
516
460
|
return this.component.onDidLayoutChange;
|
|
@@ -539,18 +483,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
539
483
|
getPanel(id) {
|
|
540
484
|
return this.component.getGroupPanel(id);
|
|
541
485
|
}
|
|
542
|
-
setActivePanel(panel) {
|
|
543
|
-
this.component.setActivePanel(panel);
|
|
544
|
-
}
|
|
545
486
|
layout(width, height, force = false) {
|
|
546
487
|
this.component.layout(width, height, force);
|
|
547
488
|
}
|
|
548
489
|
addPanel(options) {
|
|
549
490
|
return this.component.addPanel(options);
|
|
550
491
|
}
|
|
551
|
-
removePanel(panel) {
|
|
552
|
-
this.component.removePanel(panel);
|
|
553
|
-
}
|
|
554
492
|
addEmptyGroup(options) {
|
|
555
493
|
this.component.addEmptyGroup(options);
|
|
556
494
|
}
|
|
@@ -580,6 +518,46 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
580
518
|
}
|
|
581
519
|
}
|
|
582
520
|
|
|
521
|
+
var Disposable;
|
|
522
|
+
(function (Disposable) {
|
|
523
|
+
Disposable.NONE = {
|
|
524
|
+
dispose: () => {
|
|
525
|
+
// noop
|
|
526
|
+
},
|
|
527
|
+
};
|
|
528
|
+
})(Disposable || (Disposable = {}));
|
|
529
|
+
class CompositeDisposable {
|
|
530
|
+
constructor(...args) {
|
|
531
|
+
this.disposables = args;
|
|
532
|
+
}
|
|
533
|
+
static from(...args) {
|
|
534
|
+
return new CompositeDisposable(...args);
|
|
535
|
+
}
|
|
536
|
+
addDisposables(...args) {
|
|
537
|
+
args.forEach((arg) => this.disposables.push(arg));
|
|
538
|
+
}
|
|
539
|
+
dispose() {
|
|
540
|
+
this.disposables.forEach((arg) => arg.dispose());
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
class MutableDisposable {
|
|
544
|
+
constructor() {
|
|
545
|
+
this._disposable = Disposable.NONE;
|
|
546
|
+
}
|
|
547
|
+
set value(disposable) {
|
|
548
|
+
if (this._disposable) {
|
|
549
|
+
this._disposable.dispose();
|
|
550
|
+
}
|
|
551
|
+
this._disposable = disposable;
|
|
552
|
+
}
|
|
553
|
+
dispose() {
|
|
554
|
+
if (this._disposable) {
|
|
555
|
+
this._disposable.dispose();
|
|
556
|
+
this._disposable = Disposable.NONE;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
|
|
583
561
|
function watchElementResize(element, cb) {
|
|
584
562
|
const observer = new ResizeObserver((entires) => {
|
|
585
563
|
const firstEntry = entires[0];
|
|
@@ -898,7 +876,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
898
876
|
this._onDidAddView = new Emitter();
|
|
899
877
|
this.onDidAddView = this._onDidAddView.event;
|
|
900
878
|
this._onDidRemoveView = new Emitter();
|
|
901
|
-
this.onDidRemoveView = this.
|
|
879
|
+
this.onDidRemoveView = this._onDidRemoveView.event;
|
|
902
880
|
this._startSnappingEnabled = true;
|
|
903
881
|
this._endSnappingEnabled = true;
|
|
904
882
|
this.resize = (index, delta, sizes = this.views.map((x) => x.size), lowPriorityIndexes, highPriorityIndexes, overloadMinDelta = Number.NEGATIVE_INFINITY, overloadMaxDelta = Number.POSITIVE_INFINITY, snapBefore, snapAfter) => {
|
|
@@ -1525,13 +1503,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1525
1503
|
this._onDidSashEnd.dispose();
|
|
1526
1504
|
this._onDidAddView.dispose();
|
|
1527
1505
|
this._onDidRemoveView.dispose();
|
|
1528
|
-
this.element.remove();
|
|
1529
1506
|
for (let i = 0; i < this.element.children.length; i++) {
|
|
1530
1507
|
if (this.element.children.item(i) === this.element) {
|
|
1531
1508
|
this.element.removeChild(this.element);
|
|
1532
1509
|
break;
|
|
1533
1510
|
}
|
|
1534
1511
|
}
|
|
1512
|
+
this.element.remove();
|
|
1535
1513
|
}
|
|
1536
1514
|
}
|
|
1537
1515
|
|
|
@@ -1570,7 +1548,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1570
1548
|
this.paneItems.push(paneItem);
|
|
1571
1549
|
pane.orthogonalSize = this.splitview.orthogonalSize;
|
|
1572
1550
|
});
|
|
1573
|
-
this.addDisposables(this.splitview.onDidSashEnd(() => {
|
|
1551
|
+
this.addDisposables(this._onDidChange, this.splitview.onDidSashEnd(() => {
|
|
1574
1552
|
this._onDidChange.fire(undefined);
|
|
1575
1553
|
}), this.splitview.onDidAddView(() => {
|
|
1576
1554
|
this._onDidChange.fire();
|
|
@@ -1660,7 +1638,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1660
1638
|
}
|
|
1661
1639
|
dispose() {
|
|
1662
1640
|
super.dispose();
|
|
1663
|
-
this.splitview.dispose();
|
|
1664
1641
|
if (this.animationTimer) {
|
|
1665
1642
|
clearTimeout(this.animationTimer);
|
|
1666
1643
|
this.animationTimer = undefined;
|
|
@@ -1669,6 +1646,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1669
1646
|
paneItem.disposable.dispose();
|
|
1670
1647
|
});
|
|
1671
1648
|
this.paneItems = [];
|
|
1649
|
+
this.splitview.dispose();
|
|
1672
1650
|
this.element.remove();
|
|
1673
1651
|
}
|
|
1674
1652
|
}
|
|
@@ -1731,7 +1709,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1731
1709
|
this.options = options;
|
|
1732
1710
|
this._onDrop = new Emitter();
|
|
1733
1711
|
this.onDrop = this._onDrop.event;
|
|
1734
|
-
this.addDisposables(new DragAndDropObserver(this.element, {
|
|
1712
|
+
this.addDisposables(this._onDrop, new DragAndDropObserver(this.element, {
|
|
1735
1713
|
onDragEnter: (e) => undefined,
|
|
1736
1714
|
onDragOver: (e) => {
|
|
1737
1715
|
if (isBooleanValue(this.options.canDisplayOverlay)) {
|
|
@@ -1767,51 +1745,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1767
1745
|
const y = e.offsetY;
|
|
1768
1746
|
const xp = (100 * x) / width;
|
|
1769
1747
|
const yp = (100 * y) / height;
|
|
1770
|
-
|
|
1771
|
-
let isLeft = false;
|
|
1772
|
-
let isTop = false;
|
|
1773
|
-
let isBottom = false;
|
|
1774
|
-
switch (this.options.validOverlays) {
|
|
1775
|
-
case 'all':
|
|
1776
|
-
isRight = xp > 80;
|
|
1777
|
-
isLeft = xp < 20;
|
|
1778
|
-
isTop = !isRight && !isLeft && yp < 20;
|
|
1779
|
-
isBottom = !isRight && !isLeft && yp > 80;
|
|
1780
|
-
break;
|
|
1781
|
-
case 'vertical':
|
|
1782
|
-
isTop = yp < 50;
|
|
1783
|
-
isBottom = yp >= 50;
|
|
1784
|
-
break;
|
|
1785
|
-
case 'horizontal':
|
|
1786
|
-
isLeft = xp < 50;
|
|
1787
|
-
isRight = xp >= 50;
|
|
1788
|
-
break;
|
|
1789
|
-
}
|
|
1748
|
+
const quadrant = this.calculateQuadrant(this.options.validOverlays, xp, yp);
|
|
1790
1749
|
const isSmallX = width < 100;
|
|
1791
1750
|
const isSmallY = height < 100;
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
toggleClass(this.overlay, 'top', !isSmallY && isTop);
|
|
1795
|
-
toggleClass(this.overlay, 'bottom', !isSmallY && isBottom);
|
|
1796
|
-
toggleClass(this.overlay, 'small-right', isSmallX && isRight);
|
|
1797
|
-
toggleClass(this.overlay, 'small-left', isSmallX && isLeft);
|
|
1798
|
-
toggleClass(this.overlay, 'small-top', isSmallY && isTop);
|
|
1799
|
-
toggleClass(this.overlay, 'small-bottom', isSmallY && isBottom);
|
|
1800
|
-
if (isRight) {
|
|
1801
|
-
this._state = exports.Position.Right;
|
|
1802
|
-
}
|
|
1803
|
-
else if (isLeft) {
|
|
1804
|
-
this._state = exports.Position.Left;
|
|
1805
|
-
}
|
|
1806
|
-
else if (isTop) {
|
|
1807
|
-
this._state = exports.Position.Top;
|
|
1808
|
-
}
|
|
1809
|
-
else if (isBottom) {
|
|
1810
|
-
this._state = exports.Position.Bottom;
|
|
1811
|
-
}
|
|
1812
|
-
else {
|
|
1813
|
-
this._state = exports.Position.Center;
|
|
1814
|
-
}
|
|
1751
|
+
this.toggleClasses(quadrant, isSmallX, isSmallY);
|
|
1752
|
+
this.setState(quadrant);
|
|
1815
1753
|
},
|
|
1816
1754
|
onDragLeave: (e) => {
|
|
1817
1755
|
this.removeDropTarget();
|
|
@@ -1840,9 +1778,73 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1840
1778
|
this.options.canDisplayOverlay = value;
|
|
1841
1779
|
}
|
|
1842
1780
|
dispose() {
|
|
1843
|
-
this._onDrop.dispose();
|
|
1844
1781
|
this.removeDropTarget();
|
|
1845
1782
|
}
|
|
1783
|
+
toggleClasses(quadrant, isSmallX, isSmallY) {
|
|
1784
|
+
if (!this.overlay) {
|
|
1785
|
+
return;
|
|
1786
|
+
}
|
|
1787
|
+
const isLeft = quadrant === 'left';
|
|
1788
|
+
const isRight = quadrant === 'right';
|
|
1789
|
+
const isTop = quadrant === 'top';
|
|
1790
|
+
const isBottom = quadrant === 'bottom';
|
|
1791
|
+
toggleClass(this.overlay, 'right', !isSmallX && isRight);
|
|
1792
|
+
toggleClass(this.overlay, 'left', !isSmallX && isLeft);
|
|
1793
|
+
toggleClass(this.overlay, 'top', !isSmallY && isTop);
|
|
1794
|
+
toggleClass(this.overlay, 'bottom', !isSmallY && isBottom);
|
|
1795
|
+
toggleClass(this.overlay, 'small-right', isSmallX && isRight);
|
|
1796
|
+
toggleClass(this.overlay, 'small-left', isSmallX && isLeft);
|
|
1797
|
+
toggleClass(this.overlay, 'small-top', isSmallY && isTop);
|
|
1798
|
+
toggleClass(this.overlay, 'small-bottom', isSmallY && isBottom);
|
|
1799
|
+
}
|
|
1800
|
+
setState(quadrant) {
|
|
1801
|
+
switch (quadrant) {
|
|
1802
|
+
case 'top':
|
|
1803
|
+
this._state = exports.Position.Top;
|
|
1804
|
+
break;
|
|
1805
|
+
case 'left':
|
|
1806
|
+
this._state = exports.Position.Left;
|
|
1807
|
+
break;
|
|
1808
|
+
case 'bottom':
|
|
1809
|
+
this._state = exports.Position.Bottom;
|
|
1810
|
+
break;
|
|
1811
|
+
case 'right':
|
|
1812
|
+
this._state = exports.Position.Right;
|
|
1813
|
+
break;
|
|
1814
|
+
default:
|
|
1815
|
+
this._state = exports.Position.Center;
|
|
1816
|
+
break;
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
calculateQuadrant(overlayType, xp, yp) {
|
|
1820
|
+
switch (overlayType) {
|
|
1821
|
+
case 'all':
|
|
1822
|
+
if (xp < 20) {
|
|
1823
|
+
return 'left';
|
|
1824
|
+
}
|
|
1825
|
+
if (xp > 80) {
|
|
1826
|
+
return 'right';
|
|
1827
|
+
}
|
|
1828
|
+
if (yp < 20) {
|
|
1829
|
+
return 'top';
|
|
1830
|
+
}
|
|
1831
|
+
if (yp > 80) {
|
|
1832
|
+
return 'bottom';
|
|
1833
|
+
}
|
|
1834
|
+
break;
|
|
1835
|
+
case 'vertical':
|
|
1836
|
+
if (yp < 50) {
|
|
1837
|
+
return 'top';
|
|
1838
|
+
}
|
|
1839
|
+
return 'bottom';
|
|
1840
|
+
case 'horizontal':
|
|
1841
|
+
if (xp < 50) {
|
|
1842
|
+
return 'left';
|
|
1843
|
+
}
|
|
1844
|
+
return 'right';
|
|
1845
|
+
}
|
|
1846
|
+
return null;
|
|
1847
|
+
}
|
|
1846
1848
|
removeDropTarget() {
|
|
1847
1849
|
if (this.target) {
|
|
1848
1850
|
this._state = undefined;
|
|
@@ -1945,6 +1947,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1945
1947
|
this.view.layout(this.width, this.height);
|
|
1946
1948
|
}
|
|
1947
1949
|
dispose() {
|
|
1950
|
+
this._onDidChange.dispose();
|
|
1948
1951
|
this._disposable.dispose();
|
|
1949
1952
|
}
|
|
1950
1953
|
}
|
|
@@ -1962,7 +1965,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1962
1965
|
this.children = [];
|
|
1963
1966
|
this._onDidChange = new Emitter();
|
|
1964
1967
|
this.onDidChange = this._onDidChange.event;
|
|
1965
|
-
this._childrenDisposable =
|
|
1968
|
+
this._childrenDisposable = Disposable.NONE;
|
|
1966
1969
|
this._orthogonalSize = orthogonalSize;
|
|
1967
1970
|
this._size = size;
|
|
1968
1971
|
this.element = document.createElement('div');
|
|
@@ -1987,7 +1990,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1987
1990
|
: true,
|
|
1988
1991
|
};
|
|
1989
1992
|
}),
|
|
1990
|
-
size: this.
|
|
1993
|
+
size: this.size,
|
|
1991
1994
|
};
|
|
1992
1995
|
this.children = childDescriptors.map((c) => c.node);
|
|
1993
1996
|
this.splitview = new Splitview(this.element, {
|
|
@@ -1996,7 +1999,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1996
1999
|
proportionalLayout,
|
|
1997
2000
|
});
|
|
1998
2001
|
}
|
|
1999
|
-
this.addDisposables(this.splitview.onDidSashEnd(() => {
|
|
2002
|
+
this.addDisposables(this._onDidChange, this.splitview.onDidSashEnd(() => {
|
|
2000
2003
|
this._onDidChange.fire(undefined);
|
|
2001
2004
|
}));
|
|
2002
2005
|
this.setupChildrenEvents();
|
|
@@ -2168,6 +2171,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2168
2171
|
* Accreditation: This file is largly based upon the MIT licenced VSCode sourcecode found at:
|
|
2169
2172
|
* https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid
|
|
2170
2173
|
*--------------------------------------------------------------------------------------------*/
|
|
2174
|
+
function findLeaf(candiateNode, last) {
|
|
2175
|
+
if (candiateNode instanceof LeafNode) {
|
|
2176
|
+
return candiateNode;
|
|
2177
|
+
}
|
|
2178
|
+
if (candiateNode instanceof BranchNode) {
|
|
2179
|
+
return findLeaf(candiateNode.children[last ? candiateNode.children.length - 1 : 0], last);
|
|
2180
|
+
}
|
|
2181
|
+
throw new Error('invalid node');
|
|
2182
|
+
}
|
|
2171
2183
|
function flipNode(node, size, orthogonalSize) {
|
|
2172
2184
|
if (node instanceof BranchNode) {
|
|
2173
2185
|
const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize);
|
|
@@ -2299,6 +2311,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2299
2311
|
this.disposable.dispose();
|
|
2300
2312
|
this._onDidChange.dispose();
|
|
2301
2313
|
this.root.dispose();
|
|
2314
|
+
this.element.remove();
|
|
2302
2315
|
}
|
|
2303
2316
|
clear() {
|
|
2304
2317
|
const orientation = this.root.orientation;
|
|
@@ -2306,13 +2319,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2306
2319
|
}
|
|
2307
2320
|
deserialize(json, deserializer) {
|
|
2308
2321
|
const orientation = json.orientation;
|
|
2309
|
-
const height = json.height;
|
|
2322
|
+
const height = orientation === exports.Orientation.VERTICAL ? json.height : json.width;
|
|
2310
2323
|
this._deserialize(json.root, orientation, deserializer, height);
|
|
2311
2324
|
}
|
|
2312
2325
|
_deserialize(root, orientation, deserializer, orthogonalSize) {
|
|
2313
|
-
this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize);
|
|
2326
|
+
this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize, true);
|
|
2314
2327
|
}
|
|
2315
|
-
_deserializeNode(node, orientation, deserializer, orthogonalSize) {
|
|
2328
|
+
_deserializeNode(node, orientation, deserializer, orthogonalSize, isRoot = false) {
|
|
2316
2329
|
let result;
|
|
2317
2330
|
if (node.type === 'branch') {
|
|
2318
2331
|
const serializedChildren = node.data;
|
|
@@ -2322,7 +2335,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2322
2335
|
visible: serializedChild.visible,
|
|
2323
2336
|
};
|
|
2324
2337
|
});
|
|
2325
|
-
|
|
2338
|
+
// HORIZONTAL => height=orthogonalsize width=size
|
|
2339
|
+
// VERTICAL => height=size width=orthogonalsize
|
|
2340
|
+
result = new BranchNode(orientation, this.proportionalLayout, this.styles, isRoot ? orthogonalSize : node.size, isRoot ? node.size : orthogonalSize, children);
|
|
2326
2341
|
}
|
|
2327
2342
|
else {
|
|
2328
2343
|
result = new LeafNode(deserializer.fromJSON(node), orientation, orthogonalSize, node.size);
|
|
@@ -2383,15 +2398,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2383
2398
|
if (!(node instanceof LeafNode)) {
|
|
2384
2399
|
throw new Error('invalid location');
|
|
2385
2400
|
}
|
|
2386
|
-
const findLeaf = (candiateNode, last) => {
|
|
2387
|
-
if (candiateNode instanceof LeafNode) {
|
|
2388
|
-
return candiateNode;
|
|
2389
|
-
}
|
|
2390
|
-
if (candiateNode instanceof BranchNode) {
|
|
2391
|
-
return findLeaf(candiateNode.children[last ? candiateNode.children.length - 1 : 0], last);
|
|
2392
|
-
}
|
|
2393
|
-
throw new Error('invalid node');
|
|
2394
|
-
};
|
|
2395
2401
|
for (let i = path.length - 1; i > -1; i--) {
|
|
2396
2402
|
const n = path[i];
|
|
2397
2403
|
const l = location[i] || 0;
|
|
@@ -2493,9 +2499,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2493
2499
|
if (parent.children.length > 1) {
|
|
2494
2500
|
return node.view;
|
|
2495
2501
|
}
|
|
2502
|
+
const sibling = parent.children[0];
|
|
2496
2503
|
if (pathToParent.length === 0) {
|
|
2497
2504
|
// parent is root
|
|
2498
|
-
const sibling = parent.children[0];
|
|
2499
2505
|
if (sibling instanceof LeafNode) {
|
|
2500
2506
|
return node.view;
|
|
2501
2507
|
}
|
|
@@ -2506,7 +2512,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2506
2512
|
}
|
|
2507
2513
|
const [grandParent, ..._] = [...pathToParent].reverse();
|
|
2508
2514
|
const [parentIndex, ...__] = [...rest].reverse();
|
|
2509
|
-
const sibling = parent.children[0];
|
|
2510
2515
|
const isSiblingVisible = parent.isChildVisible(0);
|
|
2511
2516
|
parent.removeChild(0, sizing);
|
|
2512
2517
|
const sizes = grandParent.children.map((size, i) => grandParent.getChildSize(i));
|
|
@@ -2553,31 +2558,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2553
2558
|
}
|
|
2554
2559
|
}
|
|
2555
2560
|
|
|
2556
|
-
/*! *****************************************************************************
|
|
2557
|
-
Copyright (c) Microsoft Corporation.
|
|
2558
|
-
|
|
2559
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
2560
|
-
purpose with or without fee is hereby granted.
|
|
2561
|
-
|
|
2562
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2563
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2564
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2565
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2566
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2567
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2568
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
2569
|
-
***************************************************************************** */
|
|
2570
|
-
|
|
2571
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
2572
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2573
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2574
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2575
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2576
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2577
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2578
|
-
});
|
|
2579
|
-
}
|
|
2580
|
-
|
|
2581
2561
|
class ContentContainer extends CompositeDisposable {
|
|
2582
2562
|
constructor() {
|
|
2583
2563
|
super();
|
|
@@ -2589,6 +2569,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2589
2569
|
this._element = document.createElement('div');
|
|
2590
2570
|
this._element.className = 'content-container';
|
|
2591
2571
|
this._element.tabIndex = -1;
|
|
2572
|
+
this.addDisposables(this._onDidFocus, this._onDidBlur);
|
|
2592
2573
|
// for hosted containers
|
|
2593
2574
|
// 1) register a drop target on the host
|
|
2594
2575
|
// 2) register window dragStart events to disable pointer events
|
|
@@ -2648,13 +2629,48 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2648
2629
|
}
|
|
2649
2630
|
}
|
|
2650
2631
|
|
|
2651
|
-
var DockviewDropTargets;
|
|
2652
|
-
(function (DockviewDropTargets) {
|
|
2653
|
-
DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
|
|
2654
|
-
DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
|
|
2655
|
-
DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
|
|
2656
|
-
})(DockviewDropTargets || (DockviewDropTargets = {}));
|
|
2657
|
-
|
|
2632
|
+
var DockviewDropTargets;
|
|
2633
|
+
(function (DockviewDropTargets) {
|
|
2634
|
+
DockviewDropTargets[DockviewDropTargets["Tab"] = 0] = "Tab";
|
|
2635
|
+
DockviewDropTargets[DockviewDropTargets["Panel"] = 1] = "Panel";
|
|
2636
|
+
DockviewDropTargets[DockviewDropTargets["TabContainer"] = 2] = "TabContainer";
|
|
2637
|
+
})(DockviewDropTargets || (DockviewDropTargets = {}));
|
|
2638
|
+
|
|
2639
|
+
class DragHandler extends CompositeDisposable {
|
|
2640
|
+
constructor(el) {
|
|
2641
|
+
super();
|
|
2642
|
+
this.el = el;
|
|
2643
|
+
this.disposable = new MutableDisposable();
|
|
2644
|
+
this._onDragStart = new Emitter();
|
|
2645
|
+
this.onDragStart = this._onDragStart.event;
|
|
2646
|
+
this.iframes = [];
|
|
2647
|
+
this.configure();
|
|
2648
|
+
}
|
|
2649
|
+
configure() {
|
|
2650
|
+
this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
|
|
2651
|
+
this.iframes = [
|
|
2652
|
+
...getElementsByTagName('iframe'),
|
|
2653
|
+
...getElementsByTagName('webview'),
|
|
2654
|
+
];
|
|
2655
|
+
for (const iframe of this.iframes) {
|
|
2656
|
+
iframe.style.pointerEvents = 'none';
|
|
2657
|
+
}
|
|
2658
|
+
this.el.classList.add('dragged');
|
|
2659
|
+
setTimeout(() => this.el.classList.remove('dragged'), 0);
|
|
2660
|
+
this.disposable.value = this.getData();
|
|
2661
|
+
if (event.dataTransfer) {
|
|
2662
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
2663
|
+
}
|
|
2664
|
+
}), addDisposableListener(this.el, 'dragend', (ev) => {
|
|
2665
|
+
for (const iframe of this.iframes) {
|
|
2666
|
+
iframe.style.pointerEvents = 'auto';
|
|
2667
|
+
}
|
|
2668
|
+
this.iframes = [];
|
|
2669
|
+
this.disposable.dispose();
|
|
2670
|
+
}));
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
|
|
2658
2674
|
exports.MouseEventKind = void 0;
|
|
2659
2675
|
(function (MouseEventKind) {
|
|
2660
2676
|
MouseEventKind["CLICK"] = "CLICK";
|
|
@@ -2664,42 +2680,34 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2664
2680
|
constructor(panelId, accessor, group) {
|
|
2665
2681
|
super();
|
|
2666
2682
|
this.panelId = panelId;
|
|
2667
|
-
this.accessor = accessor;
|
|
2668
2683
|
this.group = group;
|
|
2669
2684
|
this._onChanged = new Emitter();
|
|
2670
2685
|
this.onChanged = this._onChanged.event;
|
|
2671
2686
|
this._onDropped = new Emitter();
|
|
2672
2687
|
this.onDrop = this._onDropped.event;
|
|
2673
|
-
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
2674
|
-
this.iframes = [];
|
|
2675
2688
|
this.addDisposables(this._onChanged, this._onDropped);
|
|
2676
2689
|
this._element = document.createElement('div');
|
|
2677
2690
|
this._element.className = 'tab';
|
|
2678
2691
|
this._element.tabIndex = 0;
|
|
2679
2692
|
this._element.draggable = true;
|
|
2680
|
-
this.addDisposables(
|
|
2681
|
-
|
|
2682
|
-
...
|
|
2683
|
-
|
|
2684
|
-
];
|
|
2685
|
-
for (const iframe of this.iframes) {
|
|
2686
|
-
iframe.style.pointerEvents = 'none';
|
|
2693
|
+
this.addDisposables(new (class Handler extends DragHandler {
|
|
2694
|
+
constructor() {
|
|
2695
|
+
super(...arguments);
|
|
2696
|
+
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
2687
2697
|
}
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2698
|
+
getData() {
|
|
2699
|
+
this.panelTransfer.setData([new PanelTransfer(accessor.id, group.id, panelId)], PanelTransfer.prototype);
|
|
2700
|
+
return {
|
|
2701
|
+
dispose: () => {
|
|
2702
|
+
this.panelTransfer.clearData(PanelTransfer.prototype);
|
|
2703
|
+
},
|
|
2704
|
+
};
|
|
2695
2705
|
}
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
iframe.style.pointerEvents = 'auto';
|
|
2706
|
+
dispose() {
|
|
2707
|
+
//
|
|
2699
2708
|
}
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
}), addDisposableListener(this._element, 'mousedown', (event) => {
|
|
2709
|
+
})(this._element));
|
|
2710
|
+
this.addDisposables(addDisposableListener(this._element, 'mousedown', (event) => {
|
|
2703
2711
|
if (event.defaultPrevented) {
|
|
2704
2712
|
return;
|
|
2705
2713
|
}
|
|
@@ -2901,12 +2909,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2901
2909
|
if (!isLeftClick || event.event.defaultPrevented) {
|
|
2902
2910
|
return;
|
|
2903
2911
|
}
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
});
|
|
2909
|
-
break;
|
|
2912
|
+
if (event.kind === exports.MouseEventKind.CLICK) {
|
|
2913
|
+
this.group.model.openPanel(panel, {
|
|
2914
|
+
skipFocus: alreadyFocused,
|
|
2915
|
+
});
|
|
2910
2916
|
}
|
|
2911
2917
|
}), tabToAdd.onDrop((event) => {
|
|
2912
2918
|
this._onDrop.fire({
|
|
@@ -2935,7 +2941,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2935
2941
|
GroupChangeKind2["ADD_PANEL"] = "ADD_PANEL";
|
|
2936
2942
|
GroupChangeKind2["REMOVE_PANEL"] = "REMOVE_PANEL";
|
|
2937
2943
|
GroupChangeKind2["PANEL_ACTIVE"] = "PANEL_ACTIVE";
|
|
2938
|
-
GroupChangeKind2["GROUP_ACTIVE"] = "GROUP_ACTIVE";
|
|
2939
2944
|
})(exports.GroupChangeKind2 || (exports.GroupChangeKind2 = {}));
|
|
2940
2945
|
class Groupview extends CompositeDisposable {
|
|
2941
2946
|
constructor(container, accessor, id, options, parent) {
|
|
@@ -2956,15 +2961,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2956
2961
|
this.onMove = this._onMove.event;
|
|
2957
2962
|
this._onDidGroupChange = new Emitter();
|
|
2958
2963
|
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
2959
|
-
this.
|
|
2960
|
-
|
|
2961
|
-
return false;
|
|
2962
|
-
}
|
|
2963
|
-
this.doClose(panel);
|
|
2964
|
-
return true;
|
|
2965
|
-
});
|
|
2964
|
+
this._onDidDrop = new Emitter();
|
|
2965
|
+
this.onDidDrop = this._onDidDrop.event;
|
|
2966
2966
|
this.container.classList.add('groupview');
|
|
2967
|
-
this.addDisposables(this._onMove, this._onDidGroupChange);
|
|
2967
|
+
this.addDisposables(this._onMove, this._onDidGroupChange, this._onDidChange, this._onDidDrop);
|
|
2968
2968
|
this.tabsContainer = new TabsContainer(this.accessor, this.parent, {
|
|
2969
2969
|
tabHeight: options.tabHeight,
|
|
2970
2970
|
});
|
|
@@ -3121,6 +3121,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3121
3121
|
options.index > this.panels.length) {
|
|
3122
3122
|
options.index = this.panels.length;
|
|
3123
3123
|
}
|
|
3124
|
+
// ensure the group is updated before we fire any events
|
|
3125
|
+
panel.updateParentGroup(this.parent, true);
|
|
3124
3126
|
if (this._activePanel === panel) {
|
|
3125
3127
|
this.accessor.doSetGroupActive(this.parent);
|
|
3126
3128
|
return;
|
|
@@ -3141,43 +3143,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3141
3143
|
return this._removePanel(panelToRemove);
|
|
3142
3144
|
}
|
|
3143
3145
|
closeAllPanels() {
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
const
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
if (this._activePanel && index > -1) {
|
|
3150
|
-
if (this.panels.indexOf(this._activePanel) < 0) {
|
|
3151
|
-
console.warn('active panel not tracked');
|
|
3152
|
-
}
|
|
3153
|
-
const canClose = !((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.close) || (yield this._activePanel.close());
|
|
3154
|
-
if (!canClose) {
|
|
3155
|
-
return false;
|
|
3156
|
-
}
|
|
3157
|
-
}
|
|
3158
|
-
for (let i = 0; i < this.panels.length; i++) {
|
|
3159
|
-
if (i === index) {
|
|
3160
|
-
continue;
|
|
3161
|
-
}
|
|
3162
|
-
const panel = this.panels[i];
|
|
3163
|
-
this.openPanel(panel);
|
|
3164
|
-
if (panel.close) {
|
|
3165
|
-
const canClose = yield panel.close();
|
|
3166
|
-
if (!canClose) {
|
|
3167
|
-
return false;
|
|
3168
|
-
}
|
|
3169
|
-
}
|
|
3170
|
-
}
|
|
3171
|
-
if (this.panels.length > 0) {
|
|
3172
|
-
// take a copy since we will be edting the array as we iterate through
|
|
3173
|
-
const arrPanelCpy = [...this.panels];
|
|
3174
|
-
yield Promise.all(arrPanelCpy.map((p) => this.doClose(p)));
|
|
3146
|
+
if (this.panels.length > 0) {
|
|
3147
|
+
// take a copy since we will be edting the array as we iterate through
|
|
3148
|
+
const arrPanelCpy = [...this.panels];
|
|
3149
|
+
for (const panel of arrPanelCpy) {
|
|
3150
|
+
this.doClose(panel);
|
|
3175
3151
|
}
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3152
|
+
}
|
|
3153
|
+
else {
|
|
3154
|
+
this.accessor.removeGroup(this.parent);
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
closePanel(panel) {
|
|
3158
|
+
this.doClose(panel);
|
|
3181
3159
|
}
|
|
3182
3160
|
doClose(panel) {
|
|
3183
3161
|
this.accessor.removePanel(panel);
|
|
@@ -3320,8 +3298,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3320
3298
|
this.tabsContainer.show();
|
|
3321
3299
|
}
|
|
3322
3300
|
}
|
|
3323
|
-
canDisplayOverlay(
|
|
3301
|
+
canDisplayOverlay(event, target) {
|
|
3324
3302
|
// custom overlay handler
|
|
3303
|
+
if (this.accessor.options.showDndOverlay) {
|
|
3304
|
+
return this.accessor.options.showDndOverlay(event, target);
|
|
3305
|
+
}
|
|
3325
3306
|
return false;
|
|
3326
3307
|
}
|
|
3327
3308
|
handleDropEvent(event, position, index) {
|
|
@@ -3346,6 +3327,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3346
3327
|
index,
|
|
3347
3328
|
});
|
|
3348
3329
|
}
|
|
3330
|
+
else {
|
|
3331
|
+
this._onDidDrop.fire({ nativeEvent: event, position, index });
|
|
3332
|
+
}
|
|
3349
3333
|
}
|
|
3350
3334
|
dispose() {
|
|
3351
3335
|
for (const panel of this.panels) {
|
|
@@ -3358,19 +3342,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3358
3342
|
}
|
|
3359
3343
|
}
|
|
3360
3344
|
|
|
3361
|
-
exports.GroupChangeKind = void 0;
|
|
3362
|
-
(function (GroupChangeKind) {
|
|
3363
|
-
GroupChangeKind["ADD_PANEL"] = "ADD_PANEL";
|
|
3364
|
-
GroupChangeKind["REMOVE_PANEL"] = "REMOVE_PANEL";
|
|
3365
|
-
GroupChangeKind["PANEL_ACTIVE"] = "PANEL_ACTIVE";
|
|
3366
|
-
//
|
|
3367
|
-
GroupChangeKind["GROUP_ACTIVE"] = "GROUP_ACTIVE";
|
|
3368
|
-
GroupChangeKind["ADD_GROUP"] = "ADD_GROUP";
|
|
3369
|
-
GroupChangeKind["REMOVE_GROUP"] = "REMOVE_GROUP";
|
|
3370
|
-
//
|
|
3371
|
-
GroupChangeKind["LAYOUT_FROM_JSON"] = "LAYOUT_FROM_JSON";
|
|
3372
|
-
GroupChangeKind["LAYOUT"] = "LAYOUT";
|
|
3373
|
-
})(exports.GroupChangeKind || (exports.GroupChangeKind = {}));
|
|
3374
3345
|
const nextLayoutId = sequentialNumberGenerator();
|
|
3375
3346
|
function toTarget(direction) {
|
|
3376
3347
|
switch (direction) {
|
|
@@ -3393,36 +3364,26 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3393
3364
|
this._element = _element;
|
|
3394
3365
|
this._id = nextLayoutId.next();
|
|
3395
3366
|
this._groups = new Map();
|
|
3396
|
-
//
|
|
3397
|
-
this._onGridEvent = new Emitter();
|
|
3398
|
-
this.onGridEvent = this._onGridEvent.event;
|
|
3399
3367
|
this._onDidLayoutChange = new Emitter();
|
|
3400
3368
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
3369
|
+
this._onDidRemoveGroup = new Emitter();
|
|
3370
|
+
this.onDidRemoveGroup = this._onDidRemoveGroup.event;
|
|
3371
|
+
this._onDidAddGroup = new Emitter();
|
|
3372
|
+
this.onDidAddGroup = this._onDidAddGroup.event;
|
|
3373
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
3374
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
3375
|
+
this._bufferOnDidLayoutChange = new TickDelayedEvent();
|
|
3401
3376
|
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
3402
3377
|
this.element.appendChild(this.gridview.element);
|
|
3403
|
-
|
|
3404
|
-
this.layout(0, 0, true);
|
|
3378
|
+
this.layout(0, 0, true); // set some elements height/widths
|
|
3405
3379
|
this.addDisposables(this.gridview.onDidChange(() => {
|
|
3406
|
-
this.
|
|
3380
|
+
this._onDidLayoutChange.fire();
|
|
3407
3381
|
}));
|
|
3408
|
-
this.addDisposables((() => {
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
exports.GroupChangeKind.REMOVE_GROUP,
|
|
3414
|
-
exports.GroupChangeKind.ADD_PANEL,
|
|
3415
|
-
exports.GroupChangeKind.REMOVE_PANEL,
|
|
3416
|
-
exports.GroupChangeKind.GROUP_ACTIVE,
|
|
3417
|
-
exports.GroupChangeKind.PANEL_ACTIVE,
|
|
3418
|
-
exports.GroupChangeKind.LAYOUT,
|
|
3419
|
-
].includes(event.kind)) {
|
|
3420
|
-
tickDelayedEvent.fire();
|
|
3421
|
-
}
|
|
3422
|
-
}), tickDelayedEvent.onEvent(() => {
|
|
3423
|
-
this._onDidLayoutChange.fire();
|
|
3424
|
-
}), tickDelayedEvent);
|
|
3425
|
-
})());
|
|
3382
|
+
this.addDisposables(exports.Event.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
|
|
3383
|
+
this._bufferOnDidLayoutChange.fire();
|
|
3384
|
+
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
3385
|
+
this._onDidLayoutChange.fire();
|
|
3386
|
+
}), this._bufferOnDidLayoutChange);
|
|
3426
3387
|
}
|
|
3427
3388
|
get id() {
|
|
3428
3389
|
return this._id;
|
|
@@ -3459,14 +3420,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3459
3420
|
}
|
|
3460
3421
|
setVisible(panel, visible) {
|
|
3461
3422
|
this.gridview.setViewVisible(getGridLocation(panel.element), visible);
|
|
3462
|
-
this.
|
|
3423
|
+
this._onDidLayoutChange.fire();
|
|
3463
3424
|
}
|
|
3464
3425
|
isVisible(panel) {
|
|
3465
3426
|
return this.gridview.isViewVisible(getGridLocation(panel.element));
|
|
3466
3427
|
}
|
|
3467
3428
|
doAddGroup(group, location = [0], size) {
|
|
3468
3429
|
this.gridview.addView(group, size !== null && size !== void 0 ? size : exports.Sizing.Distribute, location);
|
|
3469
|
-
this.
|
|
3430
|
+
this._onDidAddGroup.fire(group);
|
|
3470
3431
|
this.doSetGroupActive(group);
|
|
3471
3432
|
}
|
|
3472
3433
|
doRemoveGroup(group, options) {
|
|
@@ -3479,7 +3440,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3479
3440
|
item.disposable.dispose();
|
|
3480
3441
|
this._groups.delete(group.id);
|
|
3481
3442
|
}
|
|
3482
|
-
this.
|
|
3443
|
+
this._onDidRemoveGroup.fire(group);
|
|
3483
3444
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
3484
3445
|
const groups = Array.from(this._groups.values());
|
|
3485
3446
|
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
@@ -3507,9 +3468,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3507
3468
|
}
|
|
3508
3469
|
}
|
|
3509
3470
|
this._activeGroup = group;
|
|
3510
|
-
this.
|
|
3511
|
-
kind: exports.GroupChangeKind.GROUP_ACTIVE,
|
|
3512
|
-
});
|
|
3471
|
+
this._onDidActiveGroupChange.fire(group);
|
|
3513
3472
|
}
|
|
3514
3473
|
removeGroup(group) {
|
|
3515
3474
|
this.doRemoveGroup(group);
|
|
@@ -3565,7 +3524,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3565
3524
|
}
|
|
3566
3525
|
dispose() {
|
|
3567
3526
|
super.dispose();
|
|
3568
|
-
this.
|
|
3527
|
+
this._onDidActiveGroupChange.dispose();
|
|
3528
|
+
this._onDidAddGroup.dispose();
|
|
3529
|
+
this._onDidRemoveGroup.dispose();
|
|
3530
|
+
this._onDidLayoutChange.dispose();
|
|
3569
3531
|
this.gridview.dispose();
|
|
3570
3532
|
}
|
|
3571
3533
|
}
|
|
@@ -3577,15 +3539,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3577
3539
|
constructor(id) {
|
|
3578
3540
|
super();
|
|
3579
3541
|
this.id = id;
|
|
3580
|
-
this._state = {};
|
|
3581
3542
|
this._isFocused = false;
|
|
3582
3543
|
this._isActive = false;
|
|
3583
3544
|
this._isVisible = true;
|
|
3584
3545
|
this._width = 0;
|
|
3585
3546
|
this._height = 0;
|
|
3586
|
-
this._onDidStateChange = new Emitter();
|
|
3587
|
-
this.onDidStateChange = this._onDidStateChange.event;
|
|
3588
|
-
//
|
|
3589
3547
|
this._onDidPanelDimensionChange = new Emitter({
|
|
3590
3548
|
replay: true,
|
|
3591
3549
|
});
|
|
@@ -3614,7 +3572,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3614
3572
|
//
|
|
3615
3573
|
this._onActiveChange = new Emitter();
|
|
3616
3574
|
this.onActiveChange = this._onActiveChange.event;
|
|
3617
|
-
this.addDisposables(this.
|
|
3575
|
+
this.addDisposables(this._onDidPanelDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onFocusEvent, this._onActiveChange, this._onVisibilityChange, this.onDidFocusChange((event) => {
|
|
3618
3576
|
this._isFocused = event.isFocused;
|
|
3619
3577
|
}), this.onDidActiveChange((event) => {
|
|
3620
3578
|
this._isActive = event.isActive;
|
|
@@ -3647,21 +3605,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3647
3605
|
setActive() {
|
|
3648
3606
|
this._onActiveChange.fire();
|
|
3649
3607
|
}
|
|
3650
|
-
setState(key, value) {
|
|
3651
|
-
if (typeof key === 'object') {
|
|
3652
|
-
this._state = key;
|
|
3653
|
-
}
|
|
3654
|
-
else if (typeof value !== undefined) {
|
|
3655
|
-
this._state[key] = value;
|
|
3656
|
-
}
|
|
3657
|
-
this._onDidStateChange.fire(undefined);
|
|
3658
|
-
}
|
|
3659
|
-
getState() {
|
|
3660
|
-
return this._state;
|
|
3661
|
-
}
|
|
3662
|
-
getStateKey(key) {
|
|
3663
|
-
return this._state[key];
|
|
3664
|
-
}
|
|
3665
3608
|
dispose() {
|
|
3666
3609
|
super.dispose();
|
|
3667
3610
|
}
|
|
@@ -3681,6 +3624,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3681
3624
|
//
|
|
3682
3625
|
this._onDidSizeChange = new Emitter();
|
|
3683
3626
|
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
3627
|
+
this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
|
|
3684
3628
|
}
|
|
3685
3629
|
setConstraints(value) {
|
|
3686
3630
|
this._onDidConstraintsChangeInternal.fire(value);
|
|
@@ -3694,19 +3638,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3694
3638
|
constructor(panel, group) {
|
|
3695
3639
|
super(panel.id);
|
|
3696
3640
|
this.panel = panel;
|
|
3697
|
-
this._onDidDirtyChange = new Emitter();
|
|
3698
|
-
this.onDidDirtyChange = this._onDidDirtyChange.event;
|
|
3699
3641
|
this._onDidTitleChange = new Emitter();
|
|
3700
3642
|
this.onDidTitleChange = this._onDidTitleChange.event;
|
|
3701
3643
|
this._titleChanged = new Emitter();
|
|
3702
3644
|
this.titleChanged = this._titleChanged.event;
|
|
3703
3645
|
this._suppressClosableChanged = new Emitter();
|
|
3704
3646
|
this.suppressClosableChanged = this._suppressClosableChanged.event;
|
|
3705
|
-
this.
|
|
3706
|
-
this.
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3647
|
+
this._onDidActiveGroupChange = new Emitter();
|
|
3648
|
+
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
3649
|
+
this._onDidGroupChange = new Emitter();
|
|
3650
|
+
this.onDidGroupChange = this._onDidGroupChange.event;
|
|
3651
|
+
this.disposable = new MutableDisposable();
|
|
3652
|
+
this.group = group;
|
|
3653
|
+
this.addDisposables(this.disposable, this._onDidTitleChange, this._titleChanged, this._suppressClosableChanged, this._onDidGroupChange, this._onDidActiveGroupChange);
|
|
3710
3654
|
}
|
|
3711
3655
|
get title() {
|
|
3712
3656
|
return this.panel.title;
|
|
@@ -3719,7 +3663,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3719
3663
|
return !!((_a = this.group) === null || _a === void 0 ? void 0 : _a.isActive);
|
|
3720
3664
|
}
|
|
3721
3665
|
set group(value) {
|
|
3666
|
+
const isOldGroupActive = this.isGroupActive;
|
|
3722
3667
|
this._group = value;
|
|
3668
|
+
this._onDidGroupChange.fire();
|
|
3669
|
+
if (this._group) {
|
|
3670
|
+
this.disposable.value = this._group.api.onDidActiveChange(() => {
|
|
3671
|
+
this._onDidActiveGroupChange.fire();
|
|
3672
|
+
});
|
|
3673
|
+
if (this.isGroupActive !== isOldGroupActive) {
|
|
3674
|
+
this._onDidActiveGroupChange.fire();
|
|
3675
|
+
}
|
|
3676
|
+
}
|
|
3723
3677
|
}
|
|
3724
3678
|
get group() {
|
|
3725
3679
|
return this._group;
|
|
@@ -3733,16 +3687,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3733
3687
|
}
|
|
3734
3688
|
return this.group.model.closePanel(this.panel);
|
|
3735
3689
|
}
|
|
3736
|
-
interceptOnCloseAction(interceptor) {
|
|
3737
|
-
this._interceptor = interceptor;
|
|
3738
|
-
}
|
|
3739
|
-
dispose() {
|
|
3740
|
-
super.dispose();
|
|
3741
|
-
}
|
|
3742
3690
|
}
|
|
3743
3691
|
|
|
3744
3692
|
class DockviewGroupPanel extends CompositeDisposable {
|
|
3745
|
-
constructor(id, containerApi) {
|
|
3693
|
+
constructor(id, accessor, containerApi) {
|
|
3746
3694
|
super();
|
|
3747
3695
|
this.id = id;
|
|
3748
3696
|
this.containerApi = containerApi;
|
|
@@ -3750,14 +3698,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3750
3698
|
this._suppressClosable = false;
|
|
3751
3699
|
this._title = '';
|
|
3752
3700
|
this.api = new DockviewPanelApiImpl(this, this._group);
|
|
3753
|
-
this.onDidStateChange = this.api.onDidStateChange;
|
|
3754
3701
|
this.addDisposables(this.api.onActiveChange(() => {
|
|
3755
|
-
|
|
3702
|
+
accessor.setActivePanel(this);
|
|
3756
3703
|
}), this.api.onDidTitleChange((event) => {
|
|
3757
3704
|
const title = event.title;
|
|
3758
3705
|
this.update({ params: { title } });
|
|
3759
3706
|
}));
|
|
3760
3707
|
}
|
|
3708
|
+
get params() {
|
|
3709
|
+
var _a;
|
|
3710
|
+
return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
|
|
3711
|
+
}
|
|
3761
3712
|
get title() {
|
|
3762
3713
|
return this._title;
|
|
3763
3714
|
}
|
|
@@ -3776,32 +3727,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3776
3727
|
this._view = params.view;
|
|
3777
3728
|
this.setTitle(params.title);
|
|
3778
3729
|
this.setSuppressClosable(params.suppressClosable || false);
|
|
3779
|
-
if (params.state) {
|
|
3780
|
-
this.api.setState(params.state);
|
|
3781
|
-
}
|
|
3782
3730
|
(_a = this.view) === null || _a === void 0 ? void 0 : _a.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));
|
|
3783
3731
|
}
|
|
3784
3732
|
focus() {
|
|
3785
3733
|
this.api._onFocusEvent.fire();
|
|
3786
3734
|
}
|
|
3787
|
-
setDirty(isDirty) {
|
|
3788
|
-
this.api._onDidDirtyChange.fire(isDirty);
|
|
3789
|
-
}
|
|
3790
|
-
close() {
|
|
3791
|
-
if (this.api.tryClose) {
|
|
3792
|
-
return this.api.tryClose();
|
|
3793
|
-
}
|
|
3794
|
-
return Promise.resolve(true);
|
|
3795
|
-
}
|
|
3796
3735
|
toJSON() {
|
|
3797
|
-
const state = this.api.getState();
|
|
3798
3736
|
return {
|
|
3799
3737
|
id: this.id,
|
|
3800
3738
|
view: this.view.toJSON(),
|
|
3801
3739
|
params: Object.keys(this._params || {}).length > 0
|
|
3802
3740
|
? this._params
|
|
3803
3741
|
: undefined,
|
|
3804
|
-
state: state && Object.keys(state).length > 0 ? state : undefined,
|
|
3805
3742
|
suppressClosable: this.suppressClosable || undefined,
|
|
3806
3743
|
title: this.title,
|
|
3807
3744
|
};
|
|
@@ -3846,18 +3783,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3846
3783
|
var _a;
|
|
3847
3784
|
this._group = group;
|
|
3848
3785
|
this.api.group = group;
|
|
3849
|
-
this.mutableDisposable.value = this._group.model.onDidGroupChange((ev) => {
|
|
3850
|
-
var _a;
|
|
3851
|
-
if (ev.kind === exports.GroupChangeKind2.GROUP_ACTIVE) {
|
|
3852
|
-
const isVisible = !!((_a = this._group) === null || _a === void 0 ? void 0 : _a.model.isPanelActive(this));
|
|
3853
|
-
this.api._onDidActiveChange.fire({
|
|
3854
|
-
isActive: isGroupActive && isVisible,
|
|
3855
|
-
});
|
|
3856
|
-
this.api._onDidVisibilityChange.fire({
|
|
3857
|
-
isVisible,
|
|
3858
|
-
});
|
|
3859
|
-
}
|
|
3860
|
-
});
|
|
3861
3786
|
const isPanelVisible = this._group.model.isPanelActive(this);
|
|
3862
3787
|
this.api._onDidActiveChange.fire({
|
|
3863
3788
|
isActive: isGroupActive && isPanelVisible,
|
|
@@ -3967,15 +3892,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3967
3892
|
}
|
|
3968
3893
|
}
|
|
3969
3894
|
|
|
3970
|
-
function debounce(cb, wait) {
|
|
3971
|
-
let timeout;
|
|
3972
|
-
const callable = (...args) => {
|
|
3973
|
-
clearTimeout(timeout);
|
|
3974
|
-
timeout = setTimeout(() => cb(...args), wait);
|
|
3975
|
-
};
|
|
3976
|
-
return callable;
|
|
3977
|
-
}
|
|
3978
|
-
|
|
3979
3895
|
class DefaultDeserializer {
|
|
3980
3896
|
constructor(layout, panelDeserializer) {
|
|
3981
3897
|
this.layout = layout;
|
|
@@ -4076,9 +3992,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4076
3992
|
this._isGroupActive = false;
|
|
4077
3993
|
//
|
|
4078
3994
|
this.params = {};
|
|
4079
|
-
//
|
|
4080
|
-
this.isDirtyDisposable = new MutableDisposable();
|
|
4081
|
-
this.addDisposables(this.isDirtyDisposable);
|
|
4082
3995
|
this._element = document.createElement('div');
|
|
4083
3996
|
this._element.className = 'default-tab';
|
|
4084
3997
|
//
|
|
@@ -4123,10 +4036,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4123
4036
|
init(params) {
|
|
4124
4037
|
this.params = params;
|
|
4125
4038
|
this._content.textContent = params.title;
|
|
4126
|
-
this.isDirtyDisposable.value = this.params.api.onDidDirtyChange((event) => {
|
|
4127
|
-
const isDirty = event;
|
|
4128
|
-
toggleClass(this.action, 'dirty', isDirty);
|
|
4129
|
-
});
|
|
4130
4039
|
if (!this.params.suppressClosable) {
|
|
4131
4040
|
addDisposableListener(this.action, 'click', (ev) => {
|
|
4132
4041
|
ev.preventDefault(); //
|
|
@@ -4180,6 +4089,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4180
4089
|
get height() {
|
|
4181
4090
|
return this._height;
|
|
4182
4091
|
}
|
|
4092
|
+
get params() {
|
|
4093
|
+
var _a;
|
|
4094
|
+
return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
|
|
4095
|
+
}
|
|
4183
4096
|
focus() {
|
|
4184
4097
|
this.api._onFocusEvent.fire();
|
|
4185
4098
|
}
|
|
@@ -4188,29 +4101,27 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4188
4101
|
this._height = height;
|
|
4189
4102
|
this.api._onDidPanelDimensionChange.fire({ width, height });
|
|
4190
4103
|
if (this.part) {
|
|
4191
|
-
if (this.
|
|
4192
|
-
this.part.update(this.
|
|
4104
|
+
if (this._params) {
|
|
4105
|
+
this.part.update(this._params.params);
|
|
4193
4106
|
}
|
|
4194
4107
|
}
|
|
4195
4108
|
}
|
|
4196
4109
|
init(parameters) {
|
|
4197
|
-
this.
|
|
4110
|
+
this._params = parameters;
|
|
4198
4111
|
this.part = this.getComponent();
|
|
4199
4112
|
}
|
|
4200
4113
|
update(event) {
|
|
4201
4114
|
var _a, _b;
|
|
4202
|
-
this.
|
|
4203
|
-
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this.
|
|
4115
|
+
this._params = Object.assign(Object.assign({}, this._params), { params: Object.assign(Object.assign({}, (_a = this._params) === null || _a === void 0 ? void 0 : _a.params), event.params) });
|
|
4116
|
+
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
|
|
4204
4117
|
}
|
|
4205
4118
|
toJSON() {
|
|
4206
4119
|
var _a, _b;
|
|
4207
|
-
const
|
|
4208
|
-
const params = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
|
|
4120
|
+
const params = (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
|
|
4209
4121
|
return {
|
|
4210
4122
|
id: this.id,
|
|
4211
4123
|
component: this.component,
|
|
4212
4124
|
params: Object.keys(params).length > 0 ? params : undefined,
|
|
4213
|
-
state: Object.keys(state).length === 0 ? undefined : state,
|
|
4214
4125
|
};
|
|
4215
4126
|
}
|
|
4216
4127
|
dispose() {
|
|
@@ -4233,12 +4144,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4233
4144
|
this._snap = false;
|
|
4234
4145
|
this._onDidChange = new Emitter();
|
|
4235
4146
|
this.onDidChange = this._onDidChange.event;
|
|
4236
|
-
this.addDisposables(this.api.onVisibilityChange((event) => {
|
|
4147
|
+
this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
|
|
4237
4148
|
const { isVisible } = event;
|
|
4238
|
-
const { containerApi } = this.
|
|
4149
|
+
const { containerApi } = this._params;
|
|
4239
4150
|
containerApi.setVisible(this, isVisible);
|
|
4240
4151
|
}), this.api.onActiveChange(() => {
|
|
4241
|
-
const { containerApi } = this.
|
|
4152
|
+
const { containerApi } = this._params;
|
|
4242
4153
|
containerApi.setActive(this);
|
|
4243
4154
|
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
4244
4155
|
if (typeof event.minimumWidth === 'number' ||
|
|
@@ -4353,9 +4264,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4353
4264
|
const minimum = (value) => (value <= 0 ? undefined : value);
|
|
4354
4265
|
return Object.assign(Object.assign({}, state), { minimumHeight: minimum(this.minimumHeight), maximumHeight: maximum(this.maximumHeight), minimumWidth: minimum(this.minimumWidth), maximumWidth: maximum(this.maximumWidth), snap: this.snap, priority: this.priority });
|
|
4355
4266
|
}
|
|
4356
|
-
dispose() {
|
|
4357
|
-
super.dispose();
|
|
4358
|
-
}
|
|
4359
4267
|
}
|
|
4360
4268
|
|
|
4361
4269
|
class GroupviewPanel extends GridviewPanel {
|
|
@@ -4462,15 +4370,24 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4462
4370
|
orientation: options.orientation || exports.Orientation.HORIZONTAL,
|
|
4463
4371
|
styles: options.styles,
|
|
4464
4372
|
});
|
|
4465
|
-
this._panels = new Map();
|
|
4466
|
-
this.dirtyPanels = new Set();
|
|
4467
|
-
this.debouncedDeque = debounce(this.syncConfigs.bind(this), 5000);
|
|
4468
4373
|
// events
|
|
4469
4374
|
this._onTabInteractionEvent = new Emitter();
|
|
4470
4375
|
this.onTabInteractionEvent = this._onTabInteractionEvent.event;
|
|
4471
4376
|
this._onTabContextMenu = new Emitter();
|
|
4472
4377
|
this.onTabContextMenu = this._onTabContextMenu.event;
|
|
4473
|
-
this.
|
|
4378
|
+
this._onDidDrop = new Emitter();
|
|
4379
|
+
this.onDidDrop = this._onDidDrop.event;
|
|
4380
|
+
this._onDidRemovePanel = new Emitter();
|
|
4381
|
+
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
4382
|
+
this._onDidAddPanel = new Emitter();
|
|
4383
|
+
this.onDidAddPanel = this._onDidAddPanel.event;
|
|
4384
|
+
this._onDidLayoutfromJSON = new Emitter();
|
|
4385
|
+
this.onDidLayoutfromJSON = this._onDidLayoutfromJSON.event;
|
|
4386
|
+
this._onDidActivePanelChange = new Emitter();
|
|
4387
|
+
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
4388
|
+
this.addDisposables(this._onTabInteractionEvent, this._onTabContextMenu, this._onDidDrop, exports.Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
4389
|
+
this._bufferOnDidLayoutChange.fire();
|
|
4390
|
+
}));
|
|
4474
4391
|
this._options = options;
|
|
4475
4392
|
if (!this.options.components) {
|
|
4476
4393
|
this.options.components = {};
|
|
@@ -4491,10 +4408,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4491
4408
|
this._api = new DockviewApi(this);
|
|
4492
4409
|
}
|
|
4493
4410
|
get totalPanels() {
|
|
4494
|
-
return this.
|
|
4411
|
+
return this.panels.length;
|
|
4495
4412
|
}
|
|
4496
4413
|
get panels() {
|
|
4497
|
-
return
|
|
4414
|
+
return this.groups.flatMap((group) => group.model.panels);
|
|
4498
4415
|
}
|
|
4499
4416
|
get deserializer() {
|
|
4500
4417
|
return this._deserializer;
|
|
@@ -4524,10 +4441,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4524
4441
|
updateOptions(options) {
|
|
4525
4442
|
const hasOrientationChanged = typeof options.orientation === 'string' &&
|
|
4526
4443
|
this.options.orientation !== options.orientation;
|
|
4527
|
-
// TODO support style update
|
|
4528
|
-
// const hasStylesChanged =
|
|
4529
|
-
// typeof options.styles === 'object' &&
|
|
4530
|
-
// this.options.styles !== options.styles;
|
|
4531
4444
|
this._options = Object.assign(Object.assign({}, this.options), options);
|
|
4532
4445
|
if (hasOrientationChanged) {
|
|
4533
4446
|
this.gridview.orientation = options.orientation;
|
|
@@ -4539,8 +4452,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4539
4452
|
(_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
|
|
4540
4453
|
}
|
|
4541
4454
|
getGroupPanel(id) {
|
|
4542
|
-
|
|
4543
|
-
return (_a = this._panels.get(id)) === null || _a === void 0 ? void 0 : _a.value;
|
|
4455
|
+
return this.panels.find((panel) => panel.id === id);
|
|
4544
4456
|
}
|
|
4545
4457
|
setActivePanel(panel) {
|
|
4546
4458
|
if (!panel.group) {
|
|
@@ -4589,24 +4501,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4589
4501
|
this.doSetGroupActive(next);
|
|
4590
4502
|
}
|
|
4591
4503
|
}
|
|
4592
|
-
registerPanel(panel) {
|
|
4593
|
-
if (this._panels.has(panel.id)) {
|
|
4594
|
-
throw new Error(`panel ${panel.id} already exists`);
|
|
4595
|
-
}
|
|
4596
|
-
const disposable = new CompositeDisposable(panel.onDidStateChange(() => this.addDirtyPanel(panel)));
|
|
4597
|
-
this._panels.set(panel.id, { value: panel, disposable });
|
|
4598
|
-
}
|
|
4599
|
-
unregisterPanel(panel) {
|
|
4600
|
-
if (!this._panels.has(panel.id)) {
|
|
4601
|
-
throw new Error(`panel ${panel.id} doesn't exist`);
|
|
4602
|
-
}
|
|
4603
|
-
const item = this._panels.get(panel.id);
|
|
4604
|
-
if (item) {
|
|
4605
|
-
item.disposable.dispose();
|
|
4606
|
-
item.value.dispose();
|
|
4607
|
-
}
|
|
4608
|
-
this._panels.delete(panel.id);
|
|
4609
|
-
}
|
|
4610
4504
|
/**
|
|
4611
4505
|
* Serialize the current state of the layout
|
|
4612
4506
|
*
|
|
@@ -4614,12 +4508,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4614
4508
|
*/
|
|
4615
4509
|
toJSON() {
|
|
4616
4510
|
var _a;
|
|
4617
|
-
this.syncConfigs();
|
|
4618
4511
|
const data = this.gridview.serialize();
|
|
4619
|
-
const panels =
|
|
4620
|
-
|
|
4621
|
-
collection[panel.value.id] = panel.value.toJSON();
|
|
4622
|
-
}
|
|
4512
|
+
const panels = this.panels.reduce((collection, panel) => {
|
|
4513
|
+
collection[panel.id] = panel.toJSON();
|
|
4623
4514
|
return collection;
|
|
4624
4515
|
}, {});
|
|
4625
4516
|
return {
|
|
@@ -4630,13 +4521,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4630
4521
|
};
|
|
4631
4522
|
}
|
|
4632
4523
|
fromJSON(data) {
|
|
4524
|
+
const groups = Array.from(this._groups.values()).map((_) => _.value);
|
|
4525
|
+
for (const group of groups) {
|
|
4526
|
+
// remove the group will automatically remove the panels
|
|
4527
|
+
this.removeGroup(group, true);
|
|
4528
|
+
}
|
|
4633
4529
|
this.gridview.clear();
|
|
4634
|
-
this._panels.forEach((panel) => {
|
|
4635
|
-
panel.disposable.dispose();
|
|
4636
|
-
panel.value.dispose();
|
|
4637
|
-
});
|
|
4638
|
-
this._panels.clear();
|
|
4639
|
-
this._groups.clear();
|
|
4640
4530
|
if (!this.deserializer) {
|
|
4641
4531
|
throw new Error('invalid deserializer');
|
|
4642
4532
|
}
|
|
@@ -4650,9 +4540,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4650
4540
|
this.gridview.deserialize(grid, new DefaultDeserializer(this, {
|
|
4651
4541
|
createPanel: (id) => {
|
|
4652
4542
|
const panelData = panels[id];
|
|
4653
|
-
|
|
4654
|
-
this.registerPanel(panel);
|
|
4655
|
-
return panel;
|
|
4543
|
+
return this.deserializer.fromJSON(panelData);
|
|
4656
4544
|
},
|
|
4657
4545
|
}));
|
|
4658
4546
|
if (typeof activeGroup === 'string') {
|
|
@@ -4662,31 +4550,23 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4662
4550
|
}
|
|
4663
4551
|
}
|
|
4664
4552
|
this.gridview.layout(this.width, this.height);
|
|
4665
|
-
this.
|
|
4553
|
+
this._onDidLayoutfromJSON.fire();
|
|
4666
4554
|
}
|
|
4667
4555
|
closeAllGroups() {
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
if (!didCloseAll) {
|
|
4673
|
-
return false;
|
|
4674
|
-
}
|
|
4675
|
-
}
|
|
4676
|
-
return true;
|
|
4677
|
-
});
|
|
4556
|
+
for (const entry of this._groups.entries()) {
|
|
4557
|
+
const [_, group] = entry;
|
|
4558
|
+
group.value.model.closeAllPanels();
|
|
4559
|
+
}
|
|
4678
4560
|
}
|
|
4679
4561
|
fireMouseEvent(event) {
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
}
|
|
4689
|
-
break;
|
|
4562
|
+
if (event.kind === exports.MouseEventKind.CONTEXT_MENU) {
|
|
4563
|
+
if (event.tab && event.panel) {
|
|
4564
|
+
this._onTabContextMenu.fire({
|
|
4565
|
+
event: event.event,
|
|
4566
|
+
api: this._api,
|
|
4567
|
+
panel: event.panel,
|
|
4568
|
+
});
|
|
4569
|
+
}
|
|
4690
4570
|
}
|
|
4691
4571
|
}
|
|
4692
4572
|
addPanel(options) {
|
|
@@ -4719,14 +4599,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4719
4599
|
}
|
|
4720
4600
|
return panel;
|
|
4721
4601
|
}
|
|
4722
|
-
removePanel(panel) {
|
|
4723
|
-
this.unregisterPanel(panel);
|
|
4602
|
+
removePanel(panel, options = { removeEmptyGroup: true }) {
|
|
4724
4603
|
const group = panel.group;
|
|
4725
4604
|
if (!group) {
|
|
4726
4605
|
throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
|
|
4727
4606
|
}
|
|
4728
4607
|
group.model.removePanel(panel);
|
|
4729
|
-
if (group.model.size === 0) {
|
|
4608
|
+
if (group.model.size === 0 && options.removeEmptyGroup) {
|
|
4730
4609
|
this.removeGroup(group);
|
|
4731
4610
|
}
|
|
4732
4611
|
}
|
|
@@ -4739,10 +4618,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4739
4618
|
: {}, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.watermark);
|
|
4740
4619
|
}
|
|
4741
4620
|
addEmptyGroup(options) {
|
|
4742
|
-
var _a;
|
|
4743
4621
|
const group = this.createGroup();
|
|
4744
4622
|
if (options) {
|
|
4745
|
-
const referencePanel =
|
|
4623
|
+
const referencePanel = this.panels.find((panel) => panel.id === options.referencePanel);
|
|
4746
4624
|
if (!referencePanel) {
|
|
4747
4625
|
throw new Error(`reference panel ${options.referencePanel} does not exist`);
|
|
4748
4626
|
}
|
|
@@ -4759,25 +4637,23 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4759
4637
|
this.doAddGroup(group);
|
|
4760
4638
|
}
|
|
4761
4639
|
}
|
|
4762
|
-
removeGroup(group) {
|
|
4640
|
+
removeGroup(group, skipActive = false) {
|
|
4763
4641
|
const panels = [...group.model.panels]; // reassign since group panels will mutate
|
|
4764
|
-
|
|
4765
|
-
this.removePanel(panel
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
this._activeGroup = group;
|
|
4769
|
-
return;
|
|
4642
|
+
for (const panel of panels) {
|
|
4643
|
+
this.removePanel(panel, {
|
|
4644
|
+
removeEmptyGroup: false,
|
|
4645
|
+
});
|
|
4770
4646
|
}
|
|
4771
|
-
super.
|
|
4647
|
+
super.doRemoveGroup(group, { skipActive });
|
|
4772
4648
|
}
|
|
4773
4649
|
moveGroupOrPanel(referenceGroup, groupId, itemId, target, index) {
|
|
4774
|
-
var _a
|
|
4650
|
+
var _a;
|
|
4775
4651
|
const sourceGroup = groupId
|
|
4776
4652
|
? (_a = this._groups.get(groupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
4777
4653
|
: undefined;
|
|
4778
4654
|
if (!target || target === exports.Position.Center) {
|
|
4779
4655
|
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(itemId)) ||
|
|
4780
|
-
|
|
4656
|
+
this.panels.find((panel) => panel.id === itemId);
|
|
4781
4657
|
if (!groupItem) {
|
|
4782
4658
|
throw new Error(`No panel with id ${itemId}`);
|
|
4783
4659
|
}
|
|
@@ -4813,7 +4689,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4813
4689
|
}
|
|
4814
4690
|
else {
|
|
4815
4691
|
const groupItem = (sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.removePanel(itemId)) ||
|
|
4816
|
-
|
|
4692
|
+
this.panels.find((panel) => panel.id === itemId);
|
|
4817
4693
|
if (!groupItem) {
|
|
4818
4694
|
throw new Error(`No panel with id ${itemId}`);
|
|
4819
4695
|
}
|
|
@@ -4827,10 +4703,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4827
4703
|
const isGroupAlreadyFocused = this._activeGroup === group;
|
|
4828
4704
|
super.doSetGroupActive(group, skipFocus);
|
|
4829
4705
|
if (!isGroupAlreadyFocused && ((_a = this._activeGroup) === null || _a === void 0 ? void 0 : _a.model.activePanel)) {
|
|
4830
|
-
this.
|
|
4831
|
-
kind: exports.GroupChangeKind.PANEL_ACTIVE,
|
|
4832
|
-
panel: (_b = this._activeGroup) === null || _b === void 0 ? void 0 : _b.model.activePanel,
|
|
4833
|
-
});
|
|
4706
|
+
this._onDidActivePanelChange.fire((_b = this._activeGroup) === null || _b === void 0 ? void 0 : _b.model.activePanel);
|
|
4834
4707
|
}
|
|
4835
4708
|
}
|
|
4836
4709
|
createGroup(options) {
|
|
@@ -4856,31 +4729,22 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4856
4729
|
const disposable = new CompositeDisposable(view.model.onMove((event) => {
|
|
4857
4730
|
const { groupId, itemId, target, index } = event;
|
|
4858
4731
|
this.moveGroupOrPanel(view, groupId, itemId, target, index);
|
|
4732
|
+
}), view.model.onDidDrop((event) => {
|
|
4733
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { api: this._api }));
|
|
4859
4734
|
}), view.model.onDidGroupChange((event) => {
|
|
4860
4735
|
switch (event.kind) {
|
|
4861
4736
|
case exports.GroupChangeKind2.ADD_PANEL:
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
});
|
|
4866
|
-
break;
|
|
4867
|
-
case exports.GroupChangeKind2.GROUP_ACTIVE:
|
|
4868
|
-
this._onGridEvent.fire({
|
|
4869
|
-
kind: exports.GroupChangeKind.GROUP_ACTIVE,
|
|
4870
|
-
panel: event.panel,
|
|
4871
|
-
});
|
|
4737
|
+
if (event.panel) {
|
|
4738
|
+
this._onDidAddPanel.fire(event.panel);
|
|
4739
|
+
}
|
|
4872
4740
|
break;
|
|
4873
4741
|
case exports.GroupChangeKind2.REMOVE_PANEL:
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
});
|
|
4742
|
+
if (event.panel) {
|
|
4743
|
+
this._onDidRemovePanel.fire(event.panel);
|
|
4744
|
+
}
|
|
4878
4745
|
break;
|
|
4879
4746
|
case exports.GroupChangeKind2.PANEL_ACTIVE:
|
|
4880
|
-
this.
|
|
4881
|
-
kind: exports.GroupChangeKind.PANEL_ACTIVE,
|
|
4882
|
-
panel: event.panel,
|
|
4883
|
-
});
|
|
4747
|
+
this._onDidActivePanelChange.fire(event.panel);
|
|
4884
4748
|
break;
|
|
4885
4749
|
}
|
|
4886
4750
|
}));
|
|
@@ -4894,44 +4758,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4894
4758
|
}
|
|
4895
4759
|
return view;
|
|
4896
4760
|
}
|
|
4897
|
-
dispose() {
|
|
4898
|
-
super.dispose();
|
|
4899
|
-
this._onGridEvent.dispose();
|
|
4900
|
-
}
|
|
4901
|
-
/**
|
|
4902
|
-
* Ensure the local copy of the layout state is up-to-date
|
|
4903
|
-
*/
|
|
4904
|
-
syncConfigs() {
|
|
4905
|
-
const dirtyPanels = Array.from(this.dirtyPanels);
|
|
4906
|
-
if (dirtyPanels.length === 0) ;
|
|
4907
|
-
this.dirtyPanels.clear();
|
|
4908
|
-
const partialPanelState = dirtyPanels
|
|
4909
|
-
.map((panel) => this._panels.get(panel.id))
|
|
4910
|
-
.filter((_) => !!_)
|
|
4911
|
-
.reduce((collection, panel) => {
|
|
4912
|
-
collection[panel.value.id] = panel.value.toJSON();
|
|
4913
|
-
return collection;
|
|
4914
|
-
}, {});
|
|
4915
|
-
this.panelState = Object.assign(Object.assign({}, this.panelState), partialPanelState);
|
|
4916
|
-
dirtyPanels
|
|
4917
|
-
.filter((p) => this._panels.has(p.id))
|
|
4918
|
-
.forEach((panel) => {
|
|
4919
|
-
panel.setDirty(false);
|
|
4920
|
-
});
|
|
4921
|
-
}
|
|
4922
4761
|
_addPanel(options) {
|
|
4923
4762
|
const view = new DefaultGroupPanelView({
|
|
4924
4763
|
content: this.createContentComponent(options.id, options.component),
|
|
4925
4764
|
tab: this.createTabComponent(options.id, options.tabComponent),
|
|
4926
4765
|
});
|
|
4927
|
-
const panel = new DockviewGroupPanel(options.id, this._api);
|
|
4766
|
+
const panel = new DockviewGroupPanel(options.id, this, this._api);
|
|
4928
4767
|
panel.init({
|
|
4929
4768
|
view,
|
|
4930
4769
|
title: options.title || options.id,
|
|
4931
4770
|
suppressClosable: options === null || options === void 0 ? void 0 : options.suppressClosable,
|
|
4932
4771
|
params: (options === null || options === void 0 ? void 0 : options.params) || {},
|
|
4933
4772
|
});
|
|
4934
|
-
this.registerPanel(panel);
|
|
4935
4773
|
return panel;
|
|
4936
4774
|
}
|
|
4937
4775
|
createContentComponent(id, componentName) {
|
|
@@ -4951,10 +4789,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4951
4789
|
var _a;
|
|
4952
4790
|
return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
|
|
4953
4791
|
}
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
this.
|
|
4792
|
+
dispose() {
|
|
4793
|
+
super.dispose();
|
|
4794
|
+
this._onDidActivePanelChange.dispose();
|
|
4795
|
+
this._onDidAddPanel.dispose();
|
|
4796
|
+
this._onDidRemovePanel.dispose();
|
|
4797
|
+
this._onDidLayoutfromJSON.dispose();
|
|
4958
4798
|
}
|
|
4959
4799
|
}
|
|
4960
4800
|
|
|
@@ -4965,6 +4805,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
4965
4805
|
orientation: options.orientation,
|
|
4966
4806
|
styles: options.styles,
|
|
4967
4807
|
});
|
|
4808
|
+
this._onDidLayoutfromJSON = new Emitter();
|
|
4809
|
+
this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
|
|
4968
4810
|
this._options = options;
|
|
4969
4811
|
if (!this.options.components) {
|
|
4970
4812
|
this.options.components = {};
|
|
@@ -5072,7 +4914,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5072
4914
|
this.doSetGroupActive(panel);
|
|
5073
4915
|
}
|
|
5074
4916
|
}
|
|
5075
|
-
this.
|
|
4917
|
+
this._onDidLayoutfromJSON.fire();
|
|
5076
4918
|
}
|
|
5077
4919
|
movePanel(panel, options) {
|
|
5078
4920
|
var _a;
|
|
@@ -5187,6 +5029,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5187
5029
|
}
|
|
5188
5030
|
dispose() {
|
|
5189
5031
|
super.dispose();
|
|
5032
|
+
this._onDidLayoutfromJSON.dispose();
|
|
5190
5033
|
}
|
|
5191
5034
|
}
|
|
5192
5035
|
|
|
@@ -5199,6 +5042,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5199
5042
|
this.element = element;
|
|
5200
5043
|
this._disposable = new MutableDisposable();
|
|
5201
5044
|
this.panels = new Map();
|
|
5045
|
+
this._onDidAddView = new Emitter();
|
|
5046
|
+
this.onDidAddView = this._onDidAddView.event;
|
|
5047
|
+
this._onDidRemoveView = new Emitter();
|
|
5048
|
+
this.onDidRemoveView = this._onDidRemoveView.event;
|
|
5202
5049
|
this._onDidLayoutChange = new Emitter();
|
|
5203
5050
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
5204
5051
|
this._options = options;
|
|
@@ -5209,7 +5056,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5209
5056
|
options.frameworkComponents = {};
|
|
5210
5057
|
}
|
|
5211
5058
|
this.splitview = new Splitview(this.element, options);
|
|
5212
|
-
this.addDisposables(this._disposable);
|
|
5059
|
+
this.addDisposables(this._disposable, this._onDidAddView, this._onDidRemoveView, this._onDidLayoutChange);
|
|
5213
5060
|
}
|
|
5214
5061
|
get options() {
|
|
5215
5062
|
return this._options;
|
|
@@ -5224,7 +5071,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5224
5071
|
this._splitview = value;
|
|
5225
5072
|
this._disposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
|
|
5226
5073
|
this._onDidLayoutChange.fire(undefined);
|
|
5227
|
-
}));
|
|
5074
|
+
}), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
|
|
5228
5075
|
}
|
|
5229
5076
|
get minimumSize() {
|
|
5230
5077
|
return this.splitview.minimumSize;
|
|
@@ -5398,6 +5245,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5398
5245
|
});
|
|
5399
5246
|
panel.orientation = orientation;
|
|
5400
5247
|
this.doAddView(panel);
|
|
5248
|
+
setTimeout(() => {
|
|
5249
|
+
// the original onDidAddView events are missed since they are fired before we can subcribe to them
|
|
5250
|
+
this._onDidAddView.fire(panel);
|
|
5251
|
+
}, 0);
|
|
5401
5252
|
return { size: view.size, view: panel };
|
|
5402
5253
|
}),
|
|
5403
5254
|
},
|
|
@@ -5423,45 +5274,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5423
5274
|
value.dispose();
|
|
5424
5275
|
});
|
|
5425
5276
|
this.panels.clear();
|
|
5277
|
+
this.splitview.dispose();
|
|
5426
5278
|
super.dispose();
|
|
5427
5279
|
}
|
|
5428
5280
|
}
|
|
5429
5281
|
|
|
5430
|
-
class DragHandler extends CompositeDisposable {
|
|
5431
|
-
constructor(el) {
|
|
5432
|
-
super();
|
|
5433
|
-
this.el = el;
|
|
5434
|
-
this.iframes = [];
|
|
5435
|
-
this._onDragStart = new Emitter();
|
|
5436
|
-
this.onDragStart = this._onDragStart.event;
|
|
5437
|
-
this.configure();
|
|
5438
|
-
}
|
|
5439
|
-
configure() {
|
|
5440
|
-
this.addDisposables(addDisposableListener(this.el, 'dragstart', (event) => {
|
|
5441
|
-
var _a;
|
|
5442
|
-
this.iframes = [
|
|
5443
|
-
...getElementsByTagName('iframe'),
|
|
5444
|
-
...getElementsByTagName('webview'),
|
|
5445
|
-
];
|
|
5446
|
-
for (const iframe of this.iframes) {
|
|
5447
|
-
iframe.style.pointerEvents = 'none';
|
|
5448
|
-
}
|
|
5449
|
-
this.el.classList.add('dragged');
|
|
5450
|
-
setTimeout(() => this.el.classList.remove('dragged'), 0);
|
|
5451
|
-
(_a = this.disposable) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
5452
|
-
this.disposable = this.getData();
|
|
5453
|
-
}), addDisposableListener(this.el, 'dragend', (ev) => {
|
|
5454
|
-
var _a;
|
|
5455
|
-
for (const iframe of this.iframes) {
|
|
5456
|
-
iframe.style.pointerEvents = 'auto';
|
|
5457
|
-
}
|
|
5458
|
-
this.iframes = [];
|
|
5459
|
-
(_a = this.disposable) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
5460
|
-
this.disposable = undefined;
|
|
5461
|
-
}));
|
|
5462
|
-
}
|
|
5463
|
-
}
|
|
5464
|
-
|
|
5465
5282
|
class SplitviewPanelApiImpl extends PanelApiImpl {
|
|
5466
5283
|
//
|
|
5467
5284
|
constructor(id) {
|
|
@@ -5476,6 +5293,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5476
5293
|
//
|
|
5477
5294
|
this._onDidSizeChange = new Emitter();
|
|
5478
5295
|
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
5296
|
+
this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
|
|
5479
5297
|
}
|
|
5480
5298
|
setConstraints(value) {
|
|
5481
5299
|
this._onDidConstraintsChangeInternal.fire(value);
|
|
@@ -5483,11 +5301,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5483
5301
|
setSize(event) {
|
|
5484
5302
|
this._onDidSizeChange.fire(event);
|
|
5485
5303
|
}
|
|
5486
|
-
dispose() {
|
|
5487
|
-
super.dispose();
|
|
5488
|
-
this._onDidConstraintsChange.dispose();
|
|
5489
|
-
this._onDidSizeChange.dispose();
|
|
5490
|
-
}
|
|
5491
5304
|
}
|
|
5492
5305
|
|
|
5493
5306
|
class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
|
|
@@ -5501,6 +5314,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5501
5314
|
this.onMouseEnter = this._onMouseEnter.event;
|
|
5502
5315
|
this._onMouseLeave = new Emitter({});
|
|
5503
5316
|
this.onMouseLeave = this._onMouseLeave.event;
|
|
5317
|
+
this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
|
|
5504
5318
|
}
|
|
5505
5319
|
set pane(pane) {
|
|
5506
5320
|
this._pane = pane;
|
|
@@ -5516,7 +5330,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5516
5330
|
}
|
|
5517
5331
|
|
|
5518
5332
|
class PaneviewPanel extends BasePanelView {
|
|
5519
|
-
constructor(id, component, headerComponent, orientation, isExpanded) {
|
|
5333
|
+
constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
|
|
5520
5334
|
super(id, component, new PaneviewPanelApiImpl(id));
|
|
5521
5335
|
this.headerComponent = headerComponent;
|
|
5522
5336
|
this._onDidChangeExpansionState = new Emitter({ replay: true });
|
|
@@ -5532,6 +5346,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5532
5346
|
this.expandedSize = 0;
|
|
5533
5347
|
this.api.pane = this; // TODO cannot use 'this' before 'super'
|
|
5534
5348
|
this._isExpanded = isExpanded;
|
|
5349
|
+
this._headerVisible = isHeaderVisible;
|
|
5535
5350
|
this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
|
|
5536
5351
|
this._orientation = orientation;
|
|
5537
5352
|
this.element.classList.add('pane');
|
|
@@ -5599,6 +5414,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5599
5414
|
this._maximumBodySize =
|
|
5600
5415
|
typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
|
|
5601
5416
|
}
|
|
5417
|
+
get headerVisible() {
|
|
5418
|
+
return this._headerVisible;
|
|
5419
|
+
}
|
|
5420
|
+
set headerVisible(value) {
|
|
5421
|
+
this._headerVisible = value;
|
|
5422
|
+
this.header.style.display = value ? '' : 'none';
|
|
5423
|
+
}
|
|
5602
5424
|
setVisible(isVisible) {
|
|
5603
5425
|
this.api._onDidVisibilityChange.fire({ isVisible });
|
|
5604
5426
|
}
|
|
@@ -5661,7 +5483,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5661
5483
|
}
|
|
5662
5484
|
}
|
|
5663
5485
|
toJSON() {
|
|
5664
|
-
const params = this.
|
|
5486
|
+
const params = this._params;
|
|
5665
5487
|
return Object.assign(Object.assign({}, super.toJSON()), { headerComponent: this.headerComponent, title: params.title });
|
|
5666
5488
|
}
|
|
5667
5489
|
renderOnce() {
|
|
@@ -5696,7 +5518,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5696
5518
|
|
|
5697
5519
|
class DraggablePaneviewPanel extends PaneviewPanel {
|
|
5698
5520
|
constructor(id, component, headerComponent, orientation, isExpanded, disableDnd) {
|
|
5699
|
-
super(id, component, headerComponent, orientation, isExpanded);
|
|
5521
|
+
super(id, component, headerComponent, orientation, isExpanded, true);
|
|
5700
5522
|
this._onDidDrop = new Emitter();
|
|
5701
5523
|
this.onDidDrop = this._onDidDrop.event;
|
|
5702
5524
|
if (!disableDnd) {
|
|
@@ -5730,36 +5552,39 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5730
5552
|
},
|
|
5731
5553
|
});
|
|
5732
5554
|
this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
|
|
5733
|
-
|
|
5734
|
-
if (!data) {
|
|
5735
|
-
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: () => getPaneData() }));
|
|
5736
|
-
return;
|
|
5737
|
-
}
|
|
5738
|
-
const containerApi = this.params
|
|
5739
|
-
.containerApi;
|
|
5740
|
-
const panelId = data.paneId;
|
|
5741
|
-
const existingPanel = containerApi.getPanel(panelId);
|
|
5742
|
-
if (!existingPanel) {
|
|
5743
|
-
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: () => getPaneData() }));
|
|
5744
|
-
return;
|
|
5745
|
-
}
|
|
5746
|
-
const allPanels = containerApi.getPanels();
|
|
5747
|
-
const fromIndex = allPanels.indexOf(existingPanel);
|
|
5748
|
-
let toIndex = containerApi.getPanels().indexOf(this);
|
|
5749
|
-
if (event.position === exports.Position.Left ||
|
|
5750
|
-
event.position === exports.Position.Top) {
|
|
5751
|
-
toIndex = Math.max(0, toIndex - 1);
|
|
5752
|
-
}
|
|
5753
|
-
if (event.position === exports.Position.Right ||
|
|
5754
|
-
event.position === exports.Position.Bottom) {
|
|
5755
|
-
if (fromIndex > toIndex) {
|
|
5756
|
-
toIndex++;
|
|
5757
|
-
}
|
|
5758
|
-
toIndex = Math.min(allPanels.length - 1, toIndex);
|
|
5759
|
-
}
|
|
5760
|
-
containerApi.movePanel(fromIndex, toIndex);
|
|
5555
|
+
this.onDrop(event);
|
|
5761
5556
|
}));
|
|
5762
5557
|
}
|
|
5558
|
+
onDrop(event) {
|
|
5559
|
+
const data = getPaneData();
|
|
5560
|
+
if (!data) {
|
|
5561
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: () => getPaneData() }));
|
|
5562
|
+
return;
|
|
5563
|
+
}
|
|
5564
|
+
const containerApi = this._params
|
|
5565
|
+
.containerApi;
|
|
5566
|
+
const panelId = data.paneId;
|
|
5567
|
+
const existingPanel = containerApi.getPanel(panelId);
|
|
5568
|
+
if (!existingPanel) {
|
|
5569
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: () => getPaneData() }));
|
|
5570
|
+
return;
|
|
5571
|
+
}
|
|
5572
|
+
const allPanels = containerApi.getPanels();
|
|
5573
|
+
const fromIndex = allPanels.indexOf(existingPanel);
|
|
5574
|
+
let toIndex = containerApi.getPanels().indexOf(this);
|
|
5575
|
+
if (event.position === exports.Position.Left ||
|
|
5576
|
+
event.position === exports.Position.Top) {
|
|
5577
|
+
toIndex = Math.max(0, toIndex - 1);
|
|
5578
|
+
}
|
|
5579
|
+
if (event.position === exports.Position.Right ||
|
|
5580
|
+
event.position === exports.Position.Bottom) {
|
|
5581
|
+
if (fromIndex > toIndex) {
|
|
5582
|
+
toIndex++;
|
|
5583
|
+
}
|
|
5584
|
+
toIndex = Math.min(allPanels.length - 1, toIndex);
|
|
5585
|
+
}
|
|
5586
|
+
containerApi.movePanel(fromIndex, toIndex);
|
|
5587
|
+
}
|
|
5763
5588
|
}
|
|
5764
5589
|
|
|
5765
5590
|
class DefaultHeader extends CompositeDisposable {
|
|
@@ -5819,6 +5644,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5819
5644
|
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
5820
5645
|
this._onDidDrop = new Emitter();
|
|
5821
5646
|
this.onDidDrop = this._onDidDrop.event;
|
|
5647
|
+
this._onDidAddView = new Emitter();
|
|
5648
|
+
this.onDidAddView = this._onDidAddView.event;
|
|
5649
|
+
this._onDidRemoveView = new Emitter();
|
|
5650
|
+
this.onDidRemoveView = this._onDidRemoveView.event;
|
|
5651
|
+
this.addDisposables(this._onDidLayoutChange, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
|
|
5822
5652
|
this._options = options;
|
|
5823
5653
|
if (!options.components) {
|
|
5824
5654
|
options.components = {};
|
|
@@ -5832,17 +5662,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5832
5662
|
});
|
|
5833
5663
|
this.addDisposables(this._disposable);
|
|
5834
5664
|
}
|
|
5835
|
-
get onDidAddView() {
|
|
5836
|
-
return this._paneview.onDidAddView;
|
|
5837
|
-
}
|
|
5838
|
-
get onDidRemoveView() {
|
|
5839
|
-
return this._paneview.onDidRemoveView;
|
|
5840
|
-
}
|
|
5841
5665
|
set paneview(value) {
|
|
5842
5666
|
this._paneview = value;
|
|
5843
|
-
this._disposable.value = new CompositeDisposable(this.
|
|
5667
|
+
this._disposable.value = new CompositeDisposable(this._paneview.onDidChange(() => {
|
|
5844
5668
|
this._onDidLayoutChange.fire(undefined);
|
|
5845
|
-
}));
|
|
5669
|
+
}), this._paneview.onDidAddView((e) => this._onDidAddView.fire(e)), this._paneview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
|
|
5846
5670
|
}
|
|
5847
5671
|
get paneview() {
|
|
5848
5672
|
return this._paneview;
|
|
@@ -6022,6 +5846,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6022
5846
|
});
|
|
6023
5847
|
panel.orientation = this.paneview.orientation;
|
|
6024
5848
|
});
|
|
5849
|
+
setTimeout(() => {
|
|
5850
|
+
// the original onDidAddView events are missed since they are fired before we can subcribe to them
|
|
5851
|
+
this._onDidAddView.fire(panel);
|
|
5852
|
+
}, 0);
|
|
6025
5853
|
return { size: view.size, view: panel };
|
|
6026
5854
|
}),
|
|
6027
5855
|
},
|
|
@@ -6036,6 +5864,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6036
5864
|
queue.forEach((f) => f());
|
|
6037
5865
|
}
|
|
6038
5866
|
}
|
|
5867
|
+
dispose() {
|
|
5868
|
+
super.dispose();
|
|
5869
|
+
this.paneview.dispose();
|
|
5870
|
+
}
|
|
6039
5871
|
}
|
|
6040
5872
|
|
|
6041
5873
|
class SplitviewPanel extends BasePanelView {
|
|
@@ -6048,12 +5880,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6048
5880
|
this._snap = false;
|
|
6049
5881
|
this._onDidChange = new Emitter();
|
|
6050
5882
|
this.onDidChange = this._onDidChange.event;
|
|
6051
|
-
this.addDisposables(this.api.onVisibilityChange((event) => {
|
|
5883
|
+
this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
|
|
6052
5884
|
const { isVisible } = event;
|
|
6053
|
-
const { containerApi } = this
|
|
5885
|
+
const { containerApi } = this
|
|
5886
|
+
._params;
|
|
6054
5887
|
containerApi.setVisible(this, isVisible);
|
|
6055
5888
|
}), this.api.onActiveChange(() => {
|
|
6056
|
-
const { containerApi } = this
|
|
5889
|
+
const { containerApi } = this
|
|
5890
|
+
._params;
|
|
6057
5891
|
containerApi.setActive(this);
|
|
6058
5892
|
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
6059
5893
|
if (typeof event.minimumSize === 'number' ||
|
|
@@ -6196,14 +6030,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6196
6030
|
if (this.disposed) {
|
|
6197
6031
|
throw new Error('invalid operation: resource is already disposed');
|
|
6198
6032
|
}
|
|
6199
|
-
// TODO use a better check for isReactFunctionalComponent
|
|
6200
6033
|
if (typeof this.component !== 'function') {
|
|
6201
6034
|
/**
|
|
6202
6035
|
* we know this isn't a React.FunctionComponent so throw an error here.
|
|
6203
6036
|
* if we do not intercept this the React library will throw a very obsure error
|
|
6204
6037
|
* for the same reason, at least at this point we will emit a sensible stacktrace.
|
|
6205
6038
|
*/
|
|
6206
|
-
throw new Error('
|
|
6039
|
+
throw new Error('Invalid Operation. dockview only supports React Functional Components.');
|
|
6207
6040
|
}
|
|
6208
6041
|
const bridgeComponent = React__namespace.createElement(React__namespace.forwardRef(ReactComponentBridge), {
|
|
6209
6042
|
component: this
|
|
@@ -6267,16 +6100,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6267
6100
|
this._onDidBlur = new Emitter();
|
|
6268
6101
|
this.onDidBlur = this._onDidBlur.event;
|
|
6269
6102
|
this._element = document.createElement('div');
|
|
6270
|
-
this._element.
|
|
6271
|
-
this._element.style.width = '100%';
|
|
6103
|
+
this._element.className = 'dockview-react-part';
|
|
6272
6104
|
// this.hostedContainer = new HostedContainer({
|
|
6273
6105
|
// id,
|
|
6274
6106
|
// });
|
|
6275
6107
|
// this.hostedContainer.onDidFocus(() => this._onDidFocus.fire());
|
|
6276
6108
|
// this.hostedContainer.onDidBlur(() => this._onDidBlur.fire());
|
|
6277
6109
|
this._actionsElement = document.createElement('div');
|
|
6278
|
-
this._actionsElement.
|
|
6279
|
-
this._actionsElement.style.width = '100%';
|
|
6110
|
+
this._actionsElement.className = 'dockview-react-part';
|
|
6280
6111
|
}
|
|
6281
6112
|
get element() {
|
|
6282
6113
|
return this._element;
|
|
@@ -6324,6 +6155,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6324
6155
|
}
|
|
6325
6156
|
dispose() {
|
|
6326
6157
|
var _a, _b;
|
|
6158
|
+
this._onDidFocus.dispose();
|
|
6159
|
+
this._onDidBlur.dispose();
|
|
6327
6160
|
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
6328
6161
|
// this.hostedContainer?.dispose();
|
|
6329
6162
|
(_b = this.actionsPart) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
@@ -6336,6 +6169,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6336
6169
|
this.component = component;
|
|
6337
6170
|
this.reactPortalStore = reactPortalStore;
|
|
6338
6171
|
this._element = document.createElement('div');
|
|
6172
|
+
this._element.className = 'dockview-react-part';
|
|
6339
6173
|
}
|
|
6340
6174
|
get element() {
|
|
6341
6175
|
return this._element;
|
|
@@ -6380,7 +6214,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6380
6214
|
const panelId = panelData.id;
|
|
6381
6215
|
const params = panelData.params;
|
|
6382
6216
|
const title = panelData.title;
|
|
6383
|
-
const state = panelData.state;
|
|
6384
6217
|
const suppressClosable = panelData.suppressClosable;
|
|
6385
6218
|
const viewData = panelData.view;
|
|
6386
6219
|
const view = new DefaultGroupPanelView({
|
|
@@ -6389,13 +6222,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6389
6222
|
? 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)
|
|
6390
6223
|
: new DefaultTab(),
|
|
6391
6224
|
});
|
|
6392
|
-
const panel = new DockviewGroupPanel(panelId, new DockviewApi(this.layout));
|
|
6225
|
+
const panel = new DockviewGroupPanel(panelId, this.layout, new DockviewApi(this.layout));
|
|
6393
6226
|
panel.init({
|
|
6394
6227
|
view,
|
|
6395
6228
|
title,
|
|
6396
6229
|
suppressClosable,
|
|
6397
6230
|
params: params || {},
|
|
6398
|
-
state: state || {},
|
|
6399
6231
|
});
|
|
6400
6232
|
return panel;
|
|
6401
6233
|
}
|
|
@@ -6410,8 +6242,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6410
6242
|
value: undefined,
|
|
6411
6243
|
};
|
|
6412
6244
|
this._element = document.createElement('div');
|
|
6413
|
-
this._element.
|
|
6414
|
-
this._element.style.width = '100%';
|
|
6245
|
+
this._element.className = 'dockview-react-part';
|
|
6415
6246
|
}
|
|
6416
6247
|
get element() {
|
|
6417
6248
|
return this._element;
|
|
@@ -6509,12 +6340,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6509
6340
|
frameworkTabComponents: props.tabComponents,
|
|
6510
6341
|
tabHeight: props.tabHeight,
|
|
6511
6342
|
debug: props.debug,
|
|
6512
|
-
enableExternalDragEvents: props.enableExternalDragEvents,
|
|
6513
6343
|
watermarkFrameworkComponent: props.watermarkComponent,
|
|
6514
6344
|
styles: props.hideBorders
|
|
6515
6345
|
? { separatorBorder: 'transparent' }
|
|
6516
6346
|
: undefined,
|
|
6517
6347
|
});
|
|
6348
|
+
const disposable = dockview.onDidDrop((event) => {
|
|
6349
|
+
if (props.onDidDrop) {
|
|
6350
|
+
props.onDidDrop(event);
|
|
6351
|
+
}
|
|
6352
|
+
});
|
|
6518
6353
|
(_a = domRef.current) === null || _a === void 0 ? void 0 : _a.appendChild(dockview.element);
|
|
6519
6354
|
dockview.deserializer = new ReactPanelDeserialzier(dockview);
|
|
6520
6355
|
const { clientWidth, clientHeight } = domRef.current;
|
|
@@ -6524,7 +6359,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6524
6359
|
}
|
|
6525
6360
|
dockviewRef.current = dockview;
|
|
6526
6361
|
return () => {
|
|
6362
|
+
disposable.dispose();
|
|
6527
6363
|
dockview.dispose();
|
|
6364
|
+
element.remove();
|
|
6528
6365
|
};
|
|
6529
6366
|
}, []);
|
|
6530
6367
|
React__namespace.useEffect(() => {
|
|
@@ -6535,6 +6372,22 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6535
6372
|
frameworkComponents: props.components,
|
|
6536
6373
|
});
|
|
6537
6374
|
}, [props.components]);
|
|
6375
|
+
React__namespace.useEffect(() => {
|
|
6376
|
+
if (!dockviewRef.current) {
|
|
6377
|
+
return;
|
|
6378
|
+
}
|
|
6379
|
+
dockviewRef.current.updateOptions({
|
|
6380
|
+
watermarkFrameworkComponent: props.watermarkComponent,
|
|
6381
|
+
});
|
|
6382
|
+
}, [props.watermarkComponent]);
|
|
6383
|
+
React__namespace.useEffect(() => {
|
|
6384
|
+
if (!dockviewRef.current) {
|
|
6385
|
+
return;
|
|
6386
|
+
}
|
|
6387
|
+
dockviewRef.current.updateOptions({
|
|
6388
|
+
showDndOverlay: props.showDndOverlay,
|
|
6389
|
+
});
|
|
6390
|
+
}, [props.showDndOverlay]);
|
|
6538
6391
|
React__namespace.useEffect(() => {
|
|
6539
6392
|
if (!dockviewRef.current) {
|
|
6540
6393
|
return;
|
|
@@ -6623,9 +6476,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6623
6476
|
getComponent() {
|
|
6624
6477
|
var _a;
|
|
6625
6478
|
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
6626
|
-
params: ((_a = this.
|
|
6479
|
+
params: ((_a = this._params) === null || _a === void 0 ? void 0 : _a.params) || {},
|
|
6627
6480
|
api: this.api,
|
|
6628
|
-
containerApi: this.
|
|
6481
|
+
containerApi: this._params
|
|
6629
6482
|
.containerApi,
|
|
6630
6483
|
});
|
|
6631
6484
|
}
|
|
@@ -6662,7 +6515,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6662
6515
|
});
|
|
6663
6516
|
},
|
|
6664
6517
|
},
|
|
6665
|
-
proportionalLayout: props.proportionalLayout
|
|
6518
|
+
proportionalLayout: typeof props.proportionalLayout === 'boolean'
|
|
6519
|
+
? props.proportionalLayout
|
|
6520
|
+
: true,
|
|
6666
6521
|
styles: props.hideBorders
|
|
6667
6522
|
? { separatorBorder: 'transparent' }
|
|
6668
6523
|
: undefined,
|
|
@@ -6698,9 +6553,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6698
6553
|
getComponent() {
|
|
6699
6554
|
var _a;
|
|
6700
6555
|
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
6701
|
-
params: ((_a = this.
|
|
6556
|
+
params: ((_a = this._params) === null || _a === void 0 ? void 0 : _a.params) || {},
|
|
6702
6557
|
api: this.api,
|
|
6703
|
-
containerApi: this.
|
|
6558
|
+
containerApi: this._params
|
|
6704
6559
|
.containerApi,
|
|
6705
6560
|
});
|
|
6706
6561
|
}
|
|
@@ -6730,7 +6585,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6730
6585
|
var _a;
|
|
6731
6586
|
const element = document.createElement('div');
|
|
6732
6587
|
const gridview = new GridviewComponent(element, {
|
|
6733
|
-
proportionalLayout:
|
|
6588
|
+
proportionalLayout: typeof props.proportionalLayout === 'boolean'
|
|
6589
|
+
? props.proportionalLayout
|
|
6590
|
+
: true,
|
|
6734
6591
|
orientation: props.orientation,
|
|
6735
6592
|
frameworkComponents: props.components,
|
|
6736
6593
|
frameworkComponentFactory: {
|
|
@@ -6753,6 +6610,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6753
6610
|
gridviewRef.current = gridview;
|
|
6754
6611
|
return () => {
|
|
6755
6612
|
gridview.dispose();
|
|
6613
|
+
element.remove();
|
|
6756
6614
|
};
|
|
6757
6615
|
}, []);
|
|
6758
6616
|
React__namespace.useEffect(() => {
|
|
@@ -6889,14 +6747,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6889
6747
|
PaneviewReact.displayName = 'PaneviewComponent';
|
|
6890
6748
|
|
|
6891
6749
|
exports.BaseGrid = BaseGrid;
|
|
6892
|
-
exports.CompositeDisposable = CompositeDisposable;
|
|
6893
6750
|
exports.ContentContainer = ContentContainer;
|
|
6894
|
-
exports.DATA_KEY = DATA_KEY;
|
|
6895
6751
|
exports.DockviewApi = DockviewApi;
|
|
6896
6752
|
exports.DockviewComponent = DockviewComponent;
|
|
6897
6753
|
exports.DockviewComponents = DockviewComponents;
|
|
6898
6754
|
exports.DockviewReact = DockviewReact;
|
|
6899
|
-
exports.Emitter = Emitter;
|
|
6900
6755
|
exports.Gridview = Gridview;
|
|
6901
6756
|
exports.GridviewApi = GridviewApi;
|
|
6902
6757
|
exports.GridviewComponent = GridviewComponent;
|
|
@@ -6904,7 +6759,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6904
6759
|
exports.GridviewReact = GridviewReact;
|
|
6905
6760
|
exports.Groupview = Groupview;
|
|
6906
6761
|
exports.LocalSelectionTransfer = LocalSelectionTransfer;
|
|
6907
|
-
exports.MutableDisposable = MutableDisposable;
|
|
6908
6762
|
exports.PaneFramework = PaneFramework;
|
|
6909
6763
|
exports.PaneTransfer = PaneTransfer;
|
|
6910
6764
|
exports.PanelTransfer = PanelTransfer;
|
|
@@ -6923,10 +6777,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6923
6777
|
exports.SplitviewPanel = SplitviewPanel;
|
|
6924
6778
|
exports.SplitviewReact = SplitviewReact;
|
|
6925
6779
|
exports.Tab = Tab$1;
|
|
6926
|
-
exports.TickDelayedEvent = TickDelayedEvent;
|
|
6927
|
-
exports.addDisposableListener = addDisposableListener;
|
|
6928
|
-
exports.addDisposableWindowListener = addDisposableWindowListener;
|
|
6929
|
-
exports.extractData = extractData;
|
|
6930
6780
|
exports.getDirectionOrientation = getDirectionOrientation;
|
|
6931
6781
|
exports.getGridLocation = getGridLocation;
|
|
6932
6782
|
exports.getLocationOrientation = getLocationOrientation;
|
|
@@ -6934,11 +6784,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6934
6784
|
exports.getPanelData = getPanelData;
|
|
6935
6785
|
exports.getRelativeLocation = getRelativeLocation;
|
|
6936
6786
|
exports.indexInParent = indexInParent;
|
|
6937
|
-
exports.isCustomDragEvent = isCustomDragEvent;
|
|
6938
6787
|
exports.isGridBranchNode = isGridBranchNode;
|
|
6939
|
-
exports.isPanelTransferEvent = isPanelTransferEvent;
|
|
6940
6788
|
exports.isReactElement = isReactElement;
|
|
6941
|
-
exports.isTabDragEvent = isTabDragEvent;
|
|
6942
6789
|
exports.orthogonal = orthogonal;
|
|
6943
6790
|
exports.toTarget = toTarget;
|
|
6944
6791
|
exports.usePortalsLifecycle = usePortalsLifecycle;
|