dockview-react 7.0.4 → 8.0.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/LICENCE.md +21 -0
- package/README.md +21 -16
- package/dist/cjs/dockview/reactContextMenuItemPart.d.ts +10 -3
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/svg.d.ts +1 -0
- package/dist/dockview-react.js +19172 -21736
- package/dist/dockview-react.min.js +4142 -22
- package/dist/package/main.cjs.js +960 -986
- package/dist/package/main.cjs.min.js +6 -6
- package/dist/package/main.esm.min.mjs +6 -6
- package/dist/package/main.esm.mjs +926 -977
- package/dist/styles/dockview.css +3098 -2400
- package/package.json +91 -85
- package/dist/cjs/dockview/defaultTab.js +0 -99
- package/dist/cjs/dockview/dockview.js +0 -285
- package/dist/cjs/dockview/headerActionsRenderer.js +0 -86
- package/dist/cjs/dockview/reactContentPart.js +0 -52
- package/dist/cjs/dockview/reactContextMenuItemPart.js +0 -31
- package/dist/cjs/dockview/reactGroupDragGhostPart.js +0 -32
- package/dist/cjs/dockview/reactHeaderPart.js +0 -46
- package/dist/cjs/dockview/reactTabGroupChipPart.js +0 -36
- package/dist/cjs/dockview/reactWatermarkPart.js +0 -47
- package/dist/cjs/gridview/gridview.js +0 -105
- package/dist/cjs/gridview/view.js +0 -41
- package/dist/cjs/index.js +0 -24
- package/dist/cjs/paneview/paneview.js +0 -137
- package/dist/cjs/paneview/view.js +0 -44
- package/dist/cjs/react.js +0 -183
- package/dist/cjs/splitview/splitview.js +0 -105
- package/dist/cjs/splitview/view.js +0 -39
- package/dist/cjs/svg.js +0 -15
- package/dist/cjs/types.js +0 -2
- package/dist/dockview-react.min.js.map +0 -1
- package/dist/esm/dockview/defaultTab.d.ts +0 -7
- package/dist/esm/dockview/defaultTab.js +0 -65
- package/dist/esm/dockview/dockview.d.ts +0 -33
- package/dist/esm/dockview/dockview.js +0 -252
- package/dist/esm/dockview/headerActionsRenderer.d.ts +0 -24
- package/dist/esm/dockview/headerActionsRenderer.js +0 -72
- package/dist/esm/dockview/reactContentPart.d.ts +0 -21
- package/dist/esm/dockview/reactContentPart.js +0 -43
- package/dist/esm/dockview/reactContextMenuItemPart.d.ts +0 -14
- package/dist/esm/dockview/reactContextMenuItemPart.js +0 -22
- package/dist/esm/dockview/reactGroupDragGhostPart.d.ts +0 -20
- package/dist/esm/dockview/reactGroupDragGhostPart.js +0 -23
- package/dist/esm/dockview/reactHeaderPart.d.ts +0 -17
- package/dist/esm/dockview/reactHeaderPart.js +0 -37
- package/dist/esm/dockview/reactTabGroupChipPart.d.ts +0 -23
- package/dist/esm/dockview/reactTabGroupChipPart.js +0 -27
- package/dist/esm/dockview/reactWatermarkPart.d.ts +0 -18
- package/dist/esm/dockview/reactWatermarkPart.js +0 -38
- package/dist/esm/gridview/gridview.d.ts +0 -17
- package/dist/esm/gridview/gridview.js +0 -72
- package/dist/esm/gridview/view.d.ts +0 -9
- package/dist/esm/gridview/view.js +0 -19
- package/dist/esm/index.d.ts +0 -10
- package/dist/esm/index.js +0 -8
- package/dist/esm/paneview/paneview.d.ts +0 -20
- package/dist/esm/paneview/paneview.js +0 -104
- package/dist/esm/paneview/view.d.ts +0 -19
- package/dist/esm/paneview/view.js +0 -35
- package/dist/esm/react.d.ts +0 -35
- package/dist/esm/react.js +0 -134
- package/dist/esm/splitview/splitview.d.ts +0 -17
- package/dist/esm/splitview/splitview.js +0 -72
- package/dist/esm/splitview/view.d.ts +0 -9
- package/dist/esm/splitview/view.js +0 -17
- package/dist/esm/svg.d.ts +0 -3
- package/dist/esm/svg.js +0 -7
- package/dist/esm/types.d.ts +0 -4
- package/dist/esm/types.js +0 -1
package/dist/package/main.cjs.js
CHANGED
|
@@ -1,1038 +1,1012 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-react
|
|
3
|
-
* @version
|
|
4
|
-
* @link https://github.com/
|
|
3
|
+
* @version 8.0.0
|
|
4
|
+
* @link https://github.com/dockview/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
'
|
|
7
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
8
|
+
//#region \0rolldown/runtime.js
|
|
9
|
+
var __create = Object.create;
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
14
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
18
|
+
key = keys[i];
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
20
|
+
__defProp(to, key, {
|
|
21
|
+
get: ((k) => from[k]).bind(null, key),
|
|
22
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
let dockview = require("dockview");
|
|
36
|
+
let react = require("react");
|
|
37
|
+
react = __toESM(react);
|
|
38
|
+
let react_dom = require("react-dom");
|
|
39
|
+
react_dom = __toESM(react_dom);
|
|
40
|
+
|
|
41
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/typeof.js
|
|
42
|
+
function _typeof(o) {
|
|
43
|
+
"@babel/helpers - typeof";
|
|
44
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
45
|
+
return typeof o;
|
|
46
|
+
} : function(o) {
|
|
47
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
48
|
+
}, _typeof(o);
|
|
49
|
+
}
|
|
8
50
|
|
|
9
|
-
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPrimitive.js
|
|
53
|
+
function toPrimitive(t, r) {
|
|
54
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
55
|
+
var e = t[Symbol.toPrimitive];
|
|
56
|
+
if (void 0 !== e) {
|
|
57
|
+
var i = e.call(t, r || "default");
|
|
58
|
+
if ("object" != _typeof(i)) return i;
|
|
59
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
60
|
+
}
|
|
61
|
+
return ("string" === r ? String : Number)(t);
|
|
62
|
+
}
|
|
10
63
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPropertyKey.js
|
|
66
|
+
function toPropertyKey(t) {
|
|
67
|
+
var i = toPrimitive(t, "string");
|
|
68
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/defineProperty.js
|
|
73
|
+
function _defineProperty(e, r, t) {
|
|
74
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
75
|
+
value: t,
|
|
76
|
+
enumerable: !0,
|
|
77
|
+
configurable: !0,
|
|
78
|
+
writable: !0
|
|
79
|
+
}) : e[r] = t, e;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/objectSpread2.js
|
|
84
|
+
function ownKeys(e, r) {
|
|
85
|
+
var t = Object.keys(e);
|
|
86
|
+
if (Object.getOwnPropertySymbols) {
|
|
87
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
88
|
+
r && (o = o.filter(function(r) {
|
|
89
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
90
|
+
})), t.push.apply(t, o);
|
|
91
|
+
}
|
|
92
|
+
return t;
|
|
93
|
+
}
|
|
94
|
+
function _objectSpread2(e) {
|
|
95
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
96
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
97
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
98
|
+
_defineProperty(e, r, t[r]);
|
|
99
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
100
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return e;
|
|
104
|
+
}
|
|
14
105
|
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/react.ts
|
|
15
108
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
109
|
+
* This component is intended to interface between vanilla-js and React hence we need to be
|
|
110
|
+
* creative in how we update props.
|
|
111
|
+
* A ref of the component is exposed with an update method; which when called stores the props
|
|
112
|
+
* as a ref within this component and forcefully triggers a re-render of the component using
|
|
113
|
+
* the ref of props we just set on the renderered component as the props passed to the inner
|
|
114
|
+
* component
|
|
115
|
+
*/
|
|
23
116
|
const ReactComponentBridge = (props, ref) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}), []);
|
|
42
|
-
return React.createElement(props.component, _props.current);
|
|
117
|
+
const [, triggerRender] = react.default.useState(0);
|
|
118
|
+
const _props = react.default.useRef(props.componentProps);
|
|
119
|
+
react.default.useImperativeHandle(ref, () => ({ update: (componentProps) => {
|
|
120
|
+
_props.current = _objectSpread2(_objectSpread2({}, _props.current), componentProps);
|
|
121
|
+
/**
|
|
122
|
+
* setting a arbitrary piece of state within this component will
|
|
123
|
+
* trigger a re-render.
|
|
124
|
+
* we use this rather than updating through a prop since we can
|
|
125
|
+
* pass a ref into the vanilla-js world.
|
|
126
|
+
*
|
|
127
|
+
* Use a monotonic counter rather than `Date.now()` so two
|
|
128
|
+
* updates within the same millisecond still produce distinct
|
|
129
|
+
* state values and avoid React's bailout.
|
|
130
|
+
*/
|
|
131
|
+
triggerRender((n) => n + 1);
|
|
132
|
+
} }), []);
|
|
133
|
+
return react.default.createElement(props.component, _props.current);
|
|
43
134
|
};
|
|
44
|
-
ReactComponentBridge.displayName =
|
|
135
|
+
ReactComponentBridge.displayName = "DockviewReactJsBridge";
|
|
45
136
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
137
|
+
* Since we are storing the React.Portal references in a rendered array they
|
|
138
|
+
* require a key property like any other React element rendered in an array
|
|
139
|
+
* to prevent excessive re-rendering
|
|
140
|
+
*/
|
|
50
141
|
const uniquePortalKeyGenerator = (() => {
|
|
51
|
-
|
|
52
|
-
|
|
142
|
+
let value = 1;
|
|
143
|
+
return { next: () => `dockview_react_portal_key_${(value++).toString()}` };
|
|
53
144
|
})();
|
|
54
|
-
const ReactPartContext =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
: bridgeComponent;
|
|
105
|
-
const portal = ReactDOM.createPortal(node, this.parent, uniquePortalKeyGenerator.next());
|
|
106
|
-
this.ref = {
|
|
107
|
-
portal,
|
|
108
|
-
disposable: this.portalStore.addPortal(portal),
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
dispose() {
|
|
112
|
-
var _a;
|
|
113
|
-
(_a = this.ref) === null || _a === void 0 ? void 0 : _a.disposable.dispose();
|
|
114
|
-
this.disposed = true;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
145
|
+
const ReactPartContext = react.default.createContext({});
|
|
146
|
+
var ReactPart = class {
|
|
147
|
+
constructor(parent, portalStore, component, parameters, context) {
|
|
148
|
+
this.parent = parent;
|
|
149
|
+
this.portalStore = portalStore;
|
|
150
|
+
this.component = component;
|
|
151
|
+
this.parameters = parameters;
|
|
152
|
+
this.context = context;
|
|
153
|
+
this._initialProps = {};
|
|
154
|
+
this.disposed = false;
|
|
155
|
+
this.createPortal();
|
|
156
|
+
}
|
|
157
|
+
update(props) {
|
|
158
|
+
if (this.disposed) throw new Error("invalid operation: resource is already disposed");
|
|
159
|
+
if (this.componentInstance) this.componentInstance.update(props);
|
|
160
|
+
else this._initialProps = _objectSpread2(_objectSpread2({}, this._initialProps), props);
|
|
161
|
+
}
|
|
162
|
+
createPortal() {
|
|
163
|
+
if (this.disposed) throw new Error("invalid operation: resource is already disposed");
|
|
164
|
+
if (!isReactComponent(this.component))
|
|
165
|
+
/**
|
|
166
|
+
* we know this isn't a React.FunctionComponent so throw an error here.
|
|
167
|
+
* if we do not intercept then React library will throw a very obsure error
|
|
168
|
+
* for the same reason... at least at this point we will emit a sensible stacktrace.
|
|
169
|
+
*/
|
|
170
|
+
throw new Error("Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components");
|
|
171
|
+
const bridgeComponent = react.default.createElement(react.default.forwardRef(ReactComponentBridge), {
|
|
172
|
+
component: this.component,
|
|
173
|
+
componentProps: this.parameters,
|
|
174
|
+
ref: (element) => {
|
|
175
|
+
this.componentInstance = element;
|
|
176
|
+
if (Object.keys(this._initialProps).length > 0) {
|
|
177
|
+
this.componentInstance.update(this._initialProps);
|
|
178
|
+
this._initialProps = {};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
const node = this.context ? react.default.createElement(ReactPartContext.Provider, { value: this.context }, bridgeComponent) : bridgeComponent;
|
|
183
|
+
const portal = react_dom.default.createPortal(node, this.parent, uniquePortalKeyGenerator.next());
|
|
184
|
+
this.ref = {
|
|
185
|
+
portal,
|
|
186
|
+
disposable: this.portalStore.addPortal(portal)
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
dispose() {
|
|
190
|
+
var _this$ref;
|
|
191
|
+
(_this$ref = this.ref) === null || _this$ref === void 0 || _this$ref.disposable.dispose();
|
|
192
|
+
this.disposed = true;
|
|
193
|
+
}
|
|
194
|
+
};
|
|
117
195
|
/**
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
196
|
+
* A React Hook that returns an array of portals to be rendered by the user of this hook
|
|
197
|
+
* and a disposable function to add a portal. Calling dispose removes this portal from the
|
|
198
|
+
* portal array
|
|
199
|
+
*/
|
|
122
200
|
const usePortalsLifecycle = () => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
});
|
|
135
|
-
}, []);
|
|
136
|
-
return [portals, addPortal];
|
|
201
|
+
const [portals, setPortals] = react.default.useState([]);
|
|
202
|
+
react.default.useDebugValue(`Portal count: ${portals.length}`);
|
|
203
|
+
return [portals, react.default.useCallback((portal) => {
|
|
204
|
+
setPortals((existingPortals) => [...existingPortals, portal]);
|
|
205
|
+
let disposed = false;
|
|
206
|
+
return dockview.DockviewDisposable.from(() => {
|
|
207
|
+
if (disposed) throw new Error("invalid operation: resource already disposed");
|
|
208
|
+
disposed = true;
|
|
209
|
+
setPortals((existingPortals) => existingPortals.filter((p) => p !== portal));
|
|
210
|
+
});
|
|
211
|
+
}, [])];
|
|
137
212
|
};
|
|
138
213
|
function isReactComponent(component) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
!!(component === null || component === void 0 ? void 0 : component.$$typeof) /** React.memo(...) Components */);
|
|
214
|
+
/**
|
|
215
|
+
* Yes, we could use "react-is" but that would introduce an unwanted peer dependency
|
|
216
|
+
* so for now we will check in a rather crude fashion...
|
|
217
|
+
*/
|
|
218
|
+
return typeof component === "function" || !!(component === null || component === void 0 ? void 0 : component.$$typeof);
|
|
145
219
|
}
|
|
146
220
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
}
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region src/dockview/reactContentPart.ts
|
|
223
|
+
var ReactPanelContentPart = class {
|
|
224
|
+
get element() {
|
|
225
|
+
return this._element;
|
|
226
|
+
}
|
|
227
|
+
constructor(id, component, reactPortalStore) {
|
|
228
|
+
this.id = id;
|
|
229
|
+
this.component = component;
|
|
230
|
+
this.reactPortalStore = reactPortalStore;
|
|
231
|
+
this._onDidFocus = new dockview.DockviewEmitter();
|
|
232
|
+
this.onDidFocus = this._onDidFocus.event;
|
|
233
|
+
this._onDidBlur = new dockview.DockviewEmitter();
|
|
234
|
+
this.onDidBlur = this._onDidBlur.event;
|
|
235
|
+
this._element = document.createElement("div");
|
|
236
|
+
this._element.className = "dv-react-part";
|
|
237
|
+
this._element.style.height = "100%";
|
|
238
|
+
this._element.style.width = "100%";
|
|
239
|
+
}
|
|
240
|
+
focus() {}
|
|
241
|
+
init(parameters) {
|
|
242
|
+
this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
|
|
243
|
+
params: parameters.params,
|
|
244
|
+
api: parameters.api,
|
|
245
|
+
containerApi: parameters.containerApi
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
update(event) {
|
|
249
|
+
var _this$part;
|
|
250
|
+
(_this$part = this.part) === null || _this$part === void 0 || _this$part.update({ params: event.params });
|
|
251
|
+
}
|
|
252
|
+
layout(_width, _height) {}
|
|
253
|
+
dispose() {
|
|
254
|
+
var _this$part2;
|
|
255
|
+
this._onDidFocus.dispose();
|
|
256
|
+
this._onDidBlur.dispose();
|
|
257
|
+
(_this$part2 = this.part) === null || _this$part2 === void 0 || _this$part2.dispose();
|
|
258
|
+
}
|
|
259
|
+
};
|
|
188
260
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
}
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/dockview/reactHeaderPart.ts
|
|
263
|
+
var ReactPanelHeaderPart = class {
|
|
264
|
+
get element() {
|
|
265
|
+
return this._element;
|
|
266
|
+
}
|
|
267
|
+
constructor(id, component, reactPortalStore) {
|
|
268
|
+
this.id = id;
|
|
269
|
+
this.component = component;
|
|
270
|
+
this.reactPortalStore = reactPortalStore;
|
|
271
|
+
this._element = document.createElement("div");
|
|
272
|
+
this._element.className = "dv-react-part";
|
|
273
|
+
this._element.style.height = "100%";
|
|
274
|
+
this._element.style.width = "100%";
|
|
275
|
+
}
|
|
276
|
+
focus() {}
|
|
277
|
+
init(parameters) {
|
|
278
|
+
this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
|
|
279
|
+
params: parameters.params,
|
|
280
|
+
api: parameters.api,
|
|
281
|
+
containerApi: parameters.containerApi,
|
|
282
|
+
tabLocation: parameters.tabLocation
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
update(event) {
|
|
286
|
+
var _this$part;
|
|
287
|
+
(_this$part = this.part) === null || _this$part === void 0 || _this$part.update({ params: event.params });
|
|
288
|
+
}
|
|
289
|
+
layout(_width, _height) {}
|
|
290
|
+
dispose() {
|
|
291
|
+
var _this$part2;
|
|
292
|
+
(_this$part2 = this.part) === null || _this$part2 === void 0 || _this$part2.dispose();
|
|
293
|
+
}
|
|
294
|
+
};
|
|
225
295
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
var _a;
|
|
260
|
-
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
261
|
-
}
|
|
262
|
-
}
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region src/dockview/reactWatermarkPart.ts
|
|
298
|
+
var ReactWatermarkPart = class {
|
|
299
|
+
get element() {
|
|
300
|
+
return this._element;
|
|
301
|
+
}
|
|
302
|
+
constructor(id, component, reactPortalStore) {
|
|
303
|
+
this.id = id;
|
|
304
|
+
this.component = component;
|
|
305
|
+
this.reactPortalStore = reactPortalStore;
|
|
306
|
+
this._element = document.createElement("div");
|
|
307
|
+
this._element.className = "dv-react-part";
|
|
308
|
+
this._element.style.height = "100%";
|
|
309
|
+
this._element.style.width = "100%";
|
|
310
|
+
}
|
|
311
|
+
init(parameters) {
|
|
312
|
+
this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
|
|
313
|
+
group: parameters.group,
|
|
314
|
+
containerApi: parameters.containerApi
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
focus() {}
|
|
318
|
+
update(params) {
|
|
319
|
+
var _this$part, _this$parameters$para, _this$parameters;
|
|
320
|
+
if (this.parameters) this.parameters.params = params.params;
|
|
321
|
+
(_this$part = this.part) === null || _this$part === void 0 || _this$part.update({ params: (_this$parameters$para = (_this$parameters = this.parameters) === null || _this$parameters === void 0 ? void 0 : _this$parameters.params) !== null && _this$parameters$para !== void 0 ? _this$parameters$para : {} });
|
|
322
|
+
}
|
|
323
|
+
layout(_width, _height) {}
|
|
324
|
+
dispose() {
|
|
325
|
+
var _this$part2;
|
|
326
|
+
(_this$part2 = this.part) === null || _this$part2 === void 0 || _this$part2.dispose();
|
|
327
|
+
}
|
|
328
|
+
};
|
|
263
329
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
updateLocation(location) {
|
|
331
|
-
this.update({ params: { location } });
|
|
332
|
-
}
|
|
333
|
-
}
|
|
330
|
+
//#endregion
|
|
331
|
+
//#region src/dockview/headerActionsRenderer.ts
|
|
332
|
+
var ReactHeaderActionsRendererPart = class {
|
|
333
|
+
get element() {
|
|
334
|
+
return this._element;
|
|
335
|
+
}
|
|
336
|
+
get part() {
|
|
337
|
+
return this._part;
|
|
338
|
+
}
|
|
339
|
+
constructor(component, reactPortalStore, _group) {
|
|
340
|
+
this.component = component;
|
|
341
|
+
this.reactPortalStore = reactPortalStore;
|
|
342
|
+
this._group = _group;
|
|
343
|
+
this.mutableDisposable = new dockview.DockviewMutableDisposable();
|
|
344
|
+
this._element = document.createElement("div");
|
|
345
|
+
this._element.className = "dv-react-part";
|
|
346
|
+
this._element.style.height = "100%";
|
|
347
|
+
this._element.style.width = "100%";
|
|
348
|
+
}
|
|
349
|
+
init(parameters) {
|
|
350
|
+
this.mutableDisposable.value = new dockview.DockviewCompositeDisposable(this._group.model.onDidAddPanel(() => {
|
|
351
|
+
this.updatePanels();
|
|
352
|
+
}), this._group.model.onDidRemovePanel(() => {
|
|
353
|
+
this.updatePanels();
|
|
354
|
+
}), this._group.model.onDidActivePanelChange(() => {
|
|
355
|
+
this.updateActivePanel();
|
|
356
|
+
}), parameters.api.onDidActiveChange(() => {
|
|
357
|
+
this.updateGroupActive();
|
|
358
|
+
}), parameters.api.onDidLocationChange((event) => {
|
|
359
|
+
this.updateLocation(event.location);
|
|
360
|
+
}));
|
|
361
|
+
this._part = new ReactPart(this.element, this.reactPortalStore, this.component, {
|
|
362
|
+
api: parameters.api,
|
|
363
|
+
containerApi: parameters.containerApi,
|
|
364
|
+
panels: this._group.model.panels,
|
|
365
|
+
activePanel: this._group.model.activePanel,
|
|
366
|
+
isGroupActive: this._group.api.isActive,
|
|
367
|
+
group: this._group,
|
|
368
|
+
headerPosition: this._group.model.headerPosition,
|
|
369
|
+
location: parameters.api.location
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
dispose() {
|
|
373
|
+
var _this$_part;
|
|
374
|
+
this.mutableDisposable.dispose();
|
|
375
|
+
(_this$_part = this._part) === null || _this$_part === void 0 || _this$_part.dispose();
|
|
376
|
+
}
|
|
377
|
+
update(event) {
|
|
378
|
+
var _this$_part2;
|
|
379
|
+
(_this$_part2 = this._part) === null || _this$_part2 === void 0 || _this$_part2.update(event.params);
|
|
380
|
+
}
|
|
381
|
+
updatePanels() {
|
|
382
|
+
this.update({ params: { panels: this._group.model.panels } });
|
|
383
|
+
}
|
|
384
|
+
updateActivePanel() {
|
|
385
|
+
this.update({ params: { activePanel: this._group.model.activePanel } });
|
|
386
|
+
}
|
|
387
|
+
updateGroupActive() {
|
|
388
|
+
this.update({ params: { isGroupActive: this._group.api.isActive } });
|
|
389
|
+
}
|
|
390
|
+
updateLocation(location) {
|
|
391
|
+
this.update({ params: { location } });
|
|
392
|
+
}
|
|
393
|
+
};
|
|
334
394
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
395
|
+
//#endregion
|
|
396
|
+
//#region src/dockview/reactContextMenuItemPart.ts
|
|
397
|
+
var ReactContextMenuItemPart = class {
|
|
398
|
+
get element() {
|
|
399
|
+
return this._element;
|
|
400
|
+
}
|
|
401
|
+
constructor(id, component, reactPortalStore) {
|
|
402
|
+
this.id = id;
|
|
403
|
+
this.component = component;
|
|
404
|
+
this.reactPortalStore = reactPortalStore;
|
|
405
|
+
this._element = document.createElement("div");
|
|
406
|
+
this._element.className = "dv-react-part";
|
|
407
|
+
this._element.style.height = "100%";
|
|
408
|
+
this._element.style.width = "100%";
|
|
409
|
+
}
|
|
410
|
+
init(props) {
|
|
411
|
+
this.part = new ReactPart(this._element, this.reactPortalStore, this.component, props);
|
|
412
|
+
}
|
|
413
|
+
dispose() {
|
|
414
|
+
var _this$part;
|
|
415
|
+
(_this$part = this.part) === null || _this$part === void 0 || _this$part.dispose();
|
|
416
|
+
}
|
|
417
|
+
};
|
|
356
418
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region src/dockview/reactTabGroupChipPart.ts
|
|
421
|
+
var ReactTabGroupChipPart = class {
|
|
422
|
+
get element() {
|
|
423
|
+
return this._element;
|
|
424
|
+
}
|
|
425
|
+
constructor(component, reactPortalStore) {
|
|
426
|
+
this.component = component;
|
|
427
|
+
this.reactPortalStore = reactPortalStore;
|
|
428
|
+
this._element = document.createElement("div");
|
|
429
|
+
this._element.className = "dv-react-part";
|
|
430
|
+
this._element.style.display = "inline-flex";
|
|
431
|
+
}
|
|
432
|
+
init(params) {
|
|
433
|
+
this.part = new ReactPart(this._element, this.reactPortalStore, this.component, {
|
|
434
|
+
tabGroup: params.tabGroup,
|
|
435
|
+
api: params.api
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
update(params) {
|
|
439
|
+
var _this$part;
|
|
440
|
+
(_this$part = this.part) === null || _this$part === void 0 || _this$part.update({ tabGroup: params.tabGroup });
|
|
441
|
+
}
|
|
442
|
+
dispose() {
|
|
443
|
+
var _this$part2;
|
|
444
|
+
(_this$part2 = this.part) === null || _this$part2 === void 0 || _this$part2.dispose();
|
|
445
|
+
}
|
|
446
|
+
};
|
|
383
447
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region src/dockview/reactGroupDragGhostPart.ts
|
|
450
|
+
var ReactGroupDragGhostPart = class {
|
|
451
|
+
get element() {
|
|
452
|
+
return this._element;
|
|
453
|
+
}
|
|
454
|
+
constructor(component, reactPortalStore) {
|
|
455
|
+
this.component = component;
|
|
456
|
+
this.reactPortalStore = reactPortalStore;
|
|
457
|
+
this._element = document.createElement("div");
|
|
458
|
+
this._element.className = "dv-react-part";
|
|
459
|
+
this._element.style.display = "inline-flex";
|
|
460
|
+
}
|
|
461
|
+
init(params) {
|
|
462
|
+
this.part = new ReactPart(this._element, this.reactPortalStore, this.component, {
|
|
463
|
+
group: params.group,
|
|
464
|
+
api: params.api
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
dispose() {
|
|
468
|
+
var _this$part;
|
|
469
|
+
(_this$part = this.part) === null || _this$part === void 0 || _this$part.dispose();
|
|
470
|
+
}
|
|
471
|
+
};
|
|
406
472
|
|
|
473
|
+
//#endregion
|
|
474
|
+
//#region src/dockview/dockview.tsx
|
|
407
475
|
function createGroupControlElement(component, store) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
: undefined;
|
|
476
|
+
return component ? (groupPanel) => {
|
|
477
|
+
return new ReactHeaderActionsRendererPart(component, store, groupPanel);
|
|
478
|
+
} : void 0;
|
|
413
479
|
}
|
|
414
|
-
const DEFAULT_REACT_TAB =
|
|
480
|
+
const DEFAULT_REACT_TAB = "props.defaultTabComponent";
|
|
415
481
|
function extractCoreOptions$3(props) {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
return obj;
|
|
421
|
-
}, {});
|
|
422
|
-
return coreOptions;
|
|
482
|
+
return dockview.PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
|
|
483
|
+
if (key in props) obj[key] = props[key];
|
|
484
|
+
return obj;
|
|
485
|
+
}, {});
|
|
423
486
|
}
|
|
424
|
-
const DockviewReact =
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
React.useEffect(() => {
|
|
559
|
-
if (!dockviewRef.current) {
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
562
|
-
dockviewRef.current.updateOptions({
|
|
563
|
-
createGroupDragGhostComponent: props.groupDragGhostComponent
|
|
564
|
-
? () => {
|
|
565
|
-
return new ReactGroupDragGhostPart(props.groupDragGhostComponent, {
|
|
566
|
-
addPortal,
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
: undefined,
|
|
570
|
-
});
|
|
571
|
-
}, [props.groupDragGhostComponent]);
|
|
572
|
-
React.useEffect(() => {
|
|
573
|
-
if (!dockviewRef.current) {
|
|
574
|
-
return;
|
|
575
|
-
}
|
|
576
|
-
dockviewRef.current.updateOptions({
|
|
577
|
-
createComponent: (options) => {
|
|
578
|
-
return new ReactPanelContentPart(options.id, props.components[options.name], {
|
|
579
|
-
addPortal,
|
|
580
|
-
});
|
|
581
|
-
},
|
|
582
|
-
});
|
|
583
|
-
}, [props.components]);
|
|
584
|
-
React.useEffect(() => {
|
|
585
|
-
var _a;
|
|
586
|
-
if (!dockviewRef.current) {
|
|
587
|
-
return;
|
|
588
|
-
}
|
|
589
|
-
const frameworkTabComponents = (_a = props.tabComponents) !== null && _a !== void 0 ? _a : {};
|
|
590
|
-
if (props.defaultTabComponent) {
|
|
591
|
-
frameworkTabComponents[DEFAULT_REACT_TAB] =
|
|
592
|
-
props.defaultTabComponent;
|
|
593
|
-
}
|
|
594
|
-
dockviewRef.current.updateOptions({
|
|
595
|
-
defaultTabComponent: props.defaultTabComponent
|
|
596
|
-
? DEFAULT_REACT_TAB
|
|
597
|
-
: undefined,
|
|
598
|
-
createTabComponent(options) {
|
|
599
|
-
return new ReactPanelHeaderPart(options.id, frameworkTabComponents[options.name], {
|
|
600
|
-
addPortal,
|
|
601
|
-
});
|
|
602
|
-
},
|
|
603
|
-
});
|
|
604
|
-
}, [props.tabComponents, props.defaultTabComponent]);
|
|
605
|
-
React.useEffect(() => {
|
|
606
|
-
if (!dockviewRef.current) {
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
dockviewRef.current.updateOptions({
|
|
610
|
-
createWatermarkComponent: props.watermarkComponent
|
|
611
|
-
? () => {
|
|
612
|
-
return new ReactWatermarkPart('watermark', props.watermarkComponent, {
|
|
613
|
-
addPortal,
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
: undefined,
|
|
617
|
-
});
|
|
618
|
-
}, [props.watermarkComponent]);
|
|
619
|
-
React.useEffect(() => {
|
|
620
|
-
if (!dockviewRef.current) {
|
|
621
|
-
return;
|
|
622
|
-
}
|
|
623
|
-
dockviewRef.current.updateOptions({
|
|
624
|
-
createRightHeaderActionComponent: createGroupControlElement(props.rightHeaderActionsComponent, { addPortal }),
|
|
625
|
-
});
|
|
626
|
-
}, [props.rightHeaderActionsComponent]);
|
|
627
|
-
React.useEffect(() => {
|
|
628
|
-
if (!dockviewRef.current) {
|
|
629
|
-
return;
|
|
630
|
-
}
|
|
631
|
-
dockviewRef.current.updateOptions({
|
|
632
|
-
createLeftHeaderActionComponent: createGroupControlElement(props.leftHeaderActionsComponent, { addPortal }),
|
|
633
|
-
});
|
|
634
|
-
}, [props.leftHeaderActionsComponent]);
|
|
635
|
-
React.useEffect(() => {
|
|
636
|
-
if (!dockviewRef.current) {
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
dockviewRef.current.updateOptions({
|
|
640
|
-
createPrefixHeaderActionComponent: createGroupControlElement(props.prefixHeaderActionsComponent, { addPortal }),
|
|
641
|
-
});
|
|
642
|
-
}, [props.prefixHeaderActionsComponent]);
|
|
643
|
-
return (React.createElement("div", { style: { height: '100%', width: '100%' }, ref: domRef }, portals));
|
|
487
|
+
const DockviewReact = react.default.forwardRef((props, ref) => {
|
|
488
|
+
const domRef = react.default.useRef(null);
|
|
489
|
+
const dockviewRef = react.default.useRef(void 0);
|
|
490
|
+
const [portals, addPortal] = usePortalsLifecycle();
|
|
491
|
+
react.default.useImperativeHandle(ref, () => domRef.current, []);
|
|
492
|
+
const prevProps = react.default.useRef({});
|
|
493
|
+
react.default.useEffect(() => {
|
|
494
|
+
const changes = {};
|
|
495
|
+
dockview.PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {
|
|
496
|
+
const key = propKey;
|
|
497
|
+
const propValue = props[key];
|
|
498
|
+
if (key in props && propValue !== prevProps.current[key]) changes[key] = propValue;
|
|
499
|
+
});
|
|
500
|
+
if (dockviewRef.current) dockviewRef.current.updateOptions(changes);
|
|
501
|
+
prevProps.current = props;
|
|
502
|
+
}, dockview.PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
|
|
503
|
+
react.default.useEffect(() => {
|
|
504
|
+
if (!domRef.current) return;
|
|
505
|
+
const frameworkTabComponents = _objectSpread2({}, props.tabComponents);
|
|
506
|
+
if (props.defaultTabComponent) frameworkTabComponents[DEFAULT_REACT_TAB] = props.defaultTabComponent;
|
|
507
|
+
const frameworkOptions = {
|
|
508
|
+
createLeftHeaderActionComponent: createGroupControlElement(props.leftHeaderActionsComponent, { addPortal }),
|
|
509
|
+
createRightHeaderActionComponent: createGroupControlElement(props.rightHeaderActionsComponent, { addPortal }),
|
|
510
|
+
createPrefixHeaderActionComponent: createGroupControlElement(props.prefixHeaderActionsComponent, { addPortal }),
|
|
511
|
+
createComponent: (options) => {
|
|
512
|
+
return new ReactPanelContentPart(options.id, props.components[options.name], { addPortal });
|
|
513
|
+
},
|
|
514
|
+
createTabComponent(options) {
|
|
515
|
+
return new ReactPanelHeaderPart(options.id, frameworkTabComponents[options.name], { addPortal });
|
|
516
|
+
},
|
|
517
|
+
createWatermarkComponent: props.watermarkComponent ? () => {
|
|
518
|
+
return new ReactWatermarkPart("watermark", props.watermarkComponent, { addPortal });
|
|
519
|
+
} : void 0,
|
|
520
|
+
defaultTabComponent: props.defaultTabComponent ? DEFAULT_REACT_TAB : void 0,
|
|
521
|
+
createContextMenuItemComponent: (options) => {
|
|
522
|
+
if (!options.component) return;
|
|
523
|
+
return new ReactContextMenuItemPart(options.id, options.component, { addPortal });
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
const coreOptions = extractCoreOptions$3(props);
|
|
527
|
+
if (props.tabGroupChipComponent) {
|
|
528
|
+
const chipComponent = props.tabGroupChipComponent;
|
|
529
|
+
coreOptions.createTabGroupChipComponent = () => {
|
|
530
|
+
return new ReactTabGroupChipPart(chipComponent, { addPortal });
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
if (props.groupDragGhostComponent) {
|
|
534
|
+
const ghostComponent = props.groupDragGhostComponent;
|
|
535
|
+
coreOptions.createGroupDragGhostComponent = () => {
|
|
536
|
+
return new ReactGroupDragGhostPart(ghostComponent, { addPortal });
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
const api = (0, dockview.createDockview)(domRef.current, _objectSpread2(_objectSpread2({}, coreOptions), frameworkOptions));
|
|
540
|
+
const { clientWidth, clientHeight } = domRef.current;
|
|
541
|
+
api.layout(clientWidth, clientHeight);
|
|
542
|
+
if (props.onReady) props.onReady({ api });
|
|
543
|
+
dockviewRef.current = api;
|
|
544
|
+
return () => {
|
|
545
|
+
dockviewRef.current = void 0;
|
|
546
|
+
api.dispose();
|
|
547
|
+
};
|
|
548
|
+
}, []);
|
|
549
|
+
react.default.useEffect(() => {
|
|
550
|
+
if (!dockviewRef.current) return () => {};
|
|
551
|
+
const disposable = dockviewRef.current.onDidDrop((event) => {
|
|
552
|
+
if (props.onDidDrop) props.onDidDrop(event);
|
|
553
|
+
});
|
|
554
|
+
return () => {
|
|
555
|
+
disposable.dispose();
|
|
556
|
+
};
|
|
557
|
+
}, [props.onDidDrop]);
|
|
558
|
+
react.default.useEffect(() => {
|
|
559
|
+
if (!dockviewRef.current) return () => {};
|
|
560
|
+
const disposable = dockviewRef.current.onWillDrop((event) => {
|
|
561
|
+
if (props.onWillDrop) props.onWillDrop(event);
|
|
562
|
+
});
|
|
563
|
+
return () => {
|
|
564
|
+
disposable.dispose();
|
|
565
|
+
};
|
|
566
|
+
}, [props.onWillDrop]);
|
|
567
|
+
react.default.useEffect(() => {
|
|
568
|
+
if (!dockviewRef.current) return;
|
|
569
|
+
dockviewRef.current.updateOptions({ createTabGroupChipComponent: props.tabGroupChipComponent ? () => {
|
|
570
|
+
return new ReactTabGroupChipPart(props.tabGroupChipComponent, { addPortal });
|
|
571
|
+
} : void 0 });
|
|
572
|
+
}, [props.tabGroupChipComponent]);
|
|
573
|
+
react.default.useEffect(() => {
|
|
574
|
+
if (!dockviewRef.current) return;
|
|
575
|
+
dockviewRef.current.updateOptions({ createGroupDragGhostComponent: props.groupDragGhostComponent ? () => {
|
|
576
|
+
return new ReactGroupDragGhostPart(props.groupDragGhostComponent, { addPortal });
|
|
577
|
+
} : void 0 });
|
|
578
|
+
}, [props.groupDragGhostComponent]);
|
|
579
|
+
react.default.useEffect(() => {
|
|
580
|
+
if (!dockviewRef.current) return;
|
|
581
|
+
dockviewRef.current.updateOptions({ createComponent: (options) => {
|
|
582
|
+
return new ReactPanelContentPart(options.id, props.components[options.name], { addPortal });
|
|
583
|
+
} });
|
|
584
|
+
}, [props.components]);
|
|
585
|
+
react.default.useEffect(() => {
|
|
586
|
+
if (!dockviewRef.current) return;
|
|
587
|
+
const frameworkTabComponents = _objectSpread2({}, props.tabComponents);
|
|
588
|
+
if (props.defaultTabComponent) frameworkTabComponents[DEFAULT_REACT_TAB] = props.defaultTabComponent;
|
|
589
|
+
dockviewRef.current.updateOptions({
|
|
590
|
+
defaultTabComponent: props.defaultTabComponent ? DEFAULT_REACT_TAB : void 0,
|
|
591
|
+
createTabComponent(options) {
|
|
592
|
+
return new ReactPanelHeaderPart(options.id, frameworkTabComponents[options.name], { addPortal });
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
}, [props.tabComponents, props.defaultTabComponent]);
|
|
596
|
+
react.default.useEffect(() => {
|
|
597
|
+
if (!dockviewRef.current) return;
|
|
598
|
+
dockviewRef.current.updateOptions({ createWatermarkComponent: props.watermarkComponent ? () => {
|
|
599
|
+
return new ReactWatermarkPart("watermark", props.watermarkComponent, { addPortal });
|
|
600
|
+
} : void 0 });
|
|
601
|
+
}, [props.watermarkComponent]);
|
|
602
|
+
react.default.useEffect(() => {
|
|
603
|
+
if (!dockviewRef.current) return;
|
|
604
|
+
dockviewRef.current.updateOptions({ createRightHeaderActionComponent: createGroupControlElement(props.rightHeaderActionsComponent, { addPortal }) });
|
|
605
|
+
}, [props.rightHeaderActionsComponent]);
|
|
606
|
+
react.default.useEffect(() => {
|
|
607
|
+
if (!dockviewRef.current) return;
|
|
608
|
+
dockviewRef.current.updateOptions({ createLeftHeaderActionComponent: createGroupControlElement(props.leftHeaderActionsComponent, { addPortal }) });
|
|
609
|
+
}, [props.leftHeaderActionsComponent]);
|
|
610
|
+
react.default.useEffect(() => {
|
|
611
|
+
if (!dockviewRef.current) return;
|
|
612
|
+
dockviewRef.current.updateOptions({ createPrefixHeaderActionComponent: createGroupControlElement(props.prefixHeaderActionsComponent, { addPortal }) });
|
|
613
|
+
}, [props.prefixHeaderActionsComponent]);
|
|
614
|
+
return /* @__PURE__ */ react.default.createElement("div", {
|
|
615
|
+
style: {
|
|
616
|
+
height: "100%",
|
|
617
|
+
width: "100%"
|
|
618
|
+
},
|
|
619
|
+
ref: domRef
|
|
620
|
+
}, portals);
|
|
644
621
|
});
|
|
645
|
-
DockviewReact.displayName =
|
|
622
|
+
DockviewReact.displayName = "DockviewComponent";
|
|
646
623
|
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
var t = {};
|
|
666
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
667
|
-
t[p] = s[p];
|
|
668
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
669
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
670
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
671
|
-
t[p[i]] = s[p[i]];
|
|
672
|
-
}
|
|
673
|
-
return t;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
677
|
-
var e = new Error(message);
|
|
678
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
679
|
-
};
|
|
624
|
+
//#endregion
|
|
625
|
+
//#region src/svg.tsx
|
|
626
|
+
const CloseButton = () => /* @__PURE__ */ react.default.createElement("svg", {
|
|
627
|
+
height: "11",
|
|
628
|
+
width: "11",
|
|
629
|
+
viewBox: "0 0 28 28",
|
|
630
|
+
"aria-hidden": "false",
|
|
631
|
+
focusable: false,
|
|
632
|
+
className: "dv-svg"
|
|
633
|
+
}, /* @__PURE__ */ react.default.createElement("path", { d: "M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z" }));
|
|
634
|
+
const PinButton = () => /* @__PURE__ */ react.default.createElement("svg", {
|
|
635
|
+
height: "11",
|
|
636
|
+
width: "11",
|
|
637
|
+
viewBox: "0 0 24 24",
|
|
638
|
+
"aria-hidden": "false",
|
|
639
|
+
focusable: false,
|
|
640
|
+
className: "dv-svg"
|
|
641
|
+
}, /* @__PURE__ */ react.default.createElement("path", { d: "M16 9V4h1c.55 0 1-.45 1-1s-.45-1-1-1H6c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3z" }));
|
|
680
642
|
|
|
681
|
-
|
|
682
|
-
|
|
643
|
+
//#endregion
|
|
644
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/objectWithoutPropertiesLoose.js
|
|
645
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
646
|
+
if (null == r) return {};
|
|
647
|
+
var t = {};
|
|
648
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
649
|
+
if (e.includes(n)) continue;
|
|
650
|
+
t[n] = r[n];
|
|
651
|
+
}
|
|
652
|
+
return t;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
//#endregion
|
|
656
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/objectWithoutProperties.js
|
|
657
|
+
function _objectWithoutProperties(e, t) {
|
|
658
|
+
if (null == e) return {};
|
|
659
|
+
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
660
|
+
if (Object.getOwnPropertySymbols) {
|
|
661
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
662
|
+
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
663
|
+
}
|
|
664
|
+
return i;
|
|
665
|
+
}
|
|
683
666
|
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region src/dockview/defaultTab.tsx
|
|
669
|
+
const _excluded = [
|
|
670
|
+
"api",
|
|
671
|
+
"containerApi",
|
|
672
|
+
"params",
|
|
673
|
+
"hideClose",
|
|
674
|
+
"closeActionOverride",
|
|
675
|
+
"onPointerDown",
|
|
676
|
+
"onPointerUp",
|
|
677
|
+
"onPointerLeave",
|
|
678
|
+
"tabLocation"
|
|
679
|
+
];
|
|
684
680
|
function useTitle(api) {
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
};
|
|
697
|
-
}, [api]);
|
|
698
|
-
return title;
|
|
681
|
+
const [title, setTitle] = react.default.useState(api.title);
|
|
682
|
+
react.default.useEffect(() => {
|
|
683
|
+
const disposable = api.onDidTitleChange((event) => {
|
|
684
|
+
setTitle(event.title);
|
|
685
|
+
});
|
|
686
|
+
if (title !== api.title) setTitle(api.title);
|
|
687
|
+
return () => {
|
|
688
|
+
disposable.dispose();
|
|
689
|
+
};
|
|
690
|
+
}, [api]);
|
|
691
|
+
return title;
|
|
699
692
|
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
693
|
+
function useIsPinned(api) {
|
|
694
|
+
const [isPinned, setIsPinned] = react.default.useState(api.isPinned);
|
|
695
|
+
react.default.useEffect(() => {
|
|
696
|
+
const disposable = api.onDidChangePinned((event) => {
|
|
697
|
+
setIsPinned(event.isPinned);
|
|
698
|
+
});
|
|
699
|
+
if (isPinned !== api.isPinned) setIsPinned(api.isPinned);
|
|
700
|
+
return () => {
|
|
701
|
+
disposable.dispose();
|
|
702
|
+
};
|
|
703
|
+
}, [api]);
|
|
704
|
+
return isPinned;
|
|
705
|
+
}
|
|
706
|
+
const DockviewDefaultTab = (_ref) => {
|
|
707
|
+
let { api, containerApi: _containerApi, params: _params, hideClose, closeActionOverride, onPointerDown, onPointerUp, onPointerLeave, tabLocation } = _ref, rest = _objectWithoutProperties(_ref, _excluded);
|
|
708
|
+
const title = useTitle(api);
|
|
709
|
+
const isPinned = useIsPinned(api);
|
|
710
|
+
const isMiddleMouseButton = react.default.useRef(false);
|
|
711
|
+
const onClose = react.default.useCallback((event) => {
|
|
712
|
+
event.preventDefault();
|
|
713
|
+
if (closeActionOverride) closeActionOverride();
|
|
714
|
+
else api.close();
|
|
715
|
+
}, [api, closeActionOverride]);
|
|
716
|
+
const onBtnPointerDown = react.default.useCallback((event) => {
|
|
717
|
+
event.preventDefault();
|
|
718
|
+
}, []);
|
|
719
|
+
const _onPointerDown = react.default.useCallback((event) => {
|
|
720
|
+
isMiddleMouseButton.current = event.button === 1;
|
|
721
|
+
onPointerDown === null || onPointerDown === void 0 || onPointerDown(event);
|
|
722
|
+
}, [onPointerDown]);
|
|
723
|
+
const _onPointerUp = react.default.useCallback((event) => {
|
|
724
|
+
if (isMiddleMouseButton.current && event.button === 1 && !hideClose) {
|
|
725
|
+
isMiddleMouseButton.current = false;
|
|
726
|
+
onClose(event);
|
|
727
|
+
}
|
|
728
|
+
onPointerUp === null || onPointerUp === void 0 || onPointerUp(event);
|
|
729
|
+
}, [
|
|
730
|
+
onPointerUp,
|
|
731
|
+
onClose,
|
|
732
|
+
hideClose
|
|
733
|
+
]);
|
|
734
|
+
const _onPointerLeave = react.default.useCallback((event) => {
|
|
735
|
+
isMiddleMouseButton.current = false;
|
|
736
|
+
onPointerLeave === null || onPointerLeave === void 0 || onPointerLeave(event);
|
|
737
|
+
}, [onPointerLeave]);
|
|
738
|
+
return /* @__PURE__ */ react.default.createElement("div", _objectSpread2(_objectSpread2({ "data-testid": "dockview-dv-default-tab" }, rest), {}, {
|
|
739
|
+
onPointerDown: _onPointerDown,
|
|
740
|
+
onPointerUp: _onPointerUp,
|
|
741
|
+
onPointerLeave: _onPointerLeave,
|
|
742
|
+
className: "dv-default-tab"
|
|
743
|
+
}), isPinned && /* @__PURE__ */ react.default.createElement("div", { className: "dv-tab-pin" }, /* @__PURE__ */ react.default.createElement(PinButton, null)), /* @__PURE__ */ react.default.createElement("span", { className: "dv-default-tab-content" }, title), !hideClose && /* @__PURE__ */ react.default.createElement("button", {
|
|
744
|
+
type: "button",
|
|
745
|
+
className: "dv-default-tab-action",
|
|
746
|
+
"aria-label": "Close tab",
|
|
747
|
+
onPointerDown: onBtnPointerDown,
|
|
748
|
+
onClick: onClose
|
|
749
|
+
}, /* @__PURE__ */ react.default.createElement(CloseButton, null)));
|
|
735
750
|
};
|
|
736
751
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
}
|
|
752
|
+
//#endregion
|
|
753
|
+
//#region src/splitview/view.ts
|
|
754
|
+
var ReactPanelView = class extends dockview.SplitviewPanel {
|
|
755
|
+
constructor(id, component, reactComponent, reactPortalStore) {
|
|
756
|
+
super(id, component);
|
|
757
|
+
this.reactComponent = reactComponent;
|
|
758
|
+
this.reactPortalStore = reactPortalStore;
|
|
759
|
+
}
|
|
760
|
+
getComponent() {
|
|
761
|
+
var _this$_params$params, _this$_params;
|
|
762
|
+
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
763
|
+
params: (_this$_params$params = (_this$_params = this._params) === null || _this$_params === void 0 ? void 0 : _this$_params.params) !== null && _this$_params$params !== void 0 ? _this$_params$params : {},
|
|
764
|
+
api: this.api,
|
|
765
|
+
containerApi: new dockview.SplitviewApi(this._params.accessor)
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
};
|
|
752
769
|
|
|
770
|
+
//#endregion
|
|
771
|
+
//#region src/splitview/splitview.tsx
|
|
753
772
|
function extractCoreOptions$2(props) {
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
return obj;
|
|
759
|
-
}, {});
|
|
760
|
-
return coreOptions;
|
|
773
|
+
return dockview.PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {
|
|
774
|
+
if (key in props) obj[key] = props[key];
|
|
775
|
+
return obj;
|
|
776
|
+
}, {});
|
|
761
777
|
}
|
|
762
|
-
const SplitviewReact =
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
React.useEffect(() => {
|
|
806
|
-
if (!splitviewRef.current) {
|
|
807
|
-
return;
|
|
808
|
-
}
|
|
809
|
-
splitviewRef.current.updateOptions({
|
|
810
|
-
createComponent: (options) => {
|
|
811
|
-
return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
|
|
812
|
-
},
|
|
813
|
-
});
|
|
814
|
-
}, [props.components]);
|
|
815
|
-
return (React.createElement("div", { style: { height: '100%', width: '100%' }, ref: domRef }, portals));
|
|
778
|
+
const SplitviewReact = react.default.forwardRef((props, ref) => {
|
|
779
|
+
const domRef = react.default.useRef(null);
|
|
780
|
+
const splitviewRef = react.default.useRef(void 0);
|
|
781
|
+
const [portals, addPortal] = usePortalsLifecycle();
|
|
782
|
+
react.default.useImperativeHandle(ref, () => domRef.current, []);
|
|
783
|
+
const prevProps = react.default.useRef({});
|
|
784
|
+
react.default.useEffect(() => {
|
|
785
|
+
const changes = {};
|
|
786
|
+
dockview.PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {
|
|
787
|
+
const key = propKey;
|
|
788
|
+
const propValue = props[key];
|
|
789
|
+
if (key in props && propValue !== prevProps.current[key]) changes[key] = propValue;
|
|
790
|
+
});
|
|
791
|
+
if (splitviewRef.current) splitviewRef.current.updateOptions(changes);
|
|
792
|
+
prevProps.current = props;
|
|
793
|
+
}, dockview.PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
|
|
794
|
+
react.default.useEffect(() => {
|
|
795
|
+
if (!domRef.current) return () => {};
|
|
796
|
+
const api = (0, dockview.createSplitview)(domRef.current, _objectSpread2(_objectSpread2({}, extractCoreOptions$2(props)), { createComponent: (options) => {
|
|
797
|
+
return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
|
|
798
|
+
} }));
|
|
799
|
+
const { clientWidth, clientHeight } = domRef.current;
|
|
800
|
+
api.layout(clientWidth, clientHeight);
|
|
801
|
+
if (props.onReady) props.onReady({ api });
|
|
802
|
+
splitviewRef.current = api;
|
|
803
|
+
return () => {
|
|
804
|
+
splitviewRef.current = void 0;
|
|
805
|
+
api.dispose();
|
|
806
|
+
};
|
|
807
|
+
}, []);
|
|
808
|
+
react.default.useEffect(() => {
|
|
809
|
+
if (!splitviewRef.current) return;
|
|
810
|
+
splitviewRef.current.updateOptions({ createComponent: (options) => {
|
|
811
|
+
return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
|
|
812
|
+
} });
|
|
813
|
+
}, [props.components]);
|
|
814
|
+
return /* @__PURE__ */ react.default.createElement("div", {
|
|
815
|
+
style: {
|
|
816
|
+
height: "100%",
|
|
817
|
+
width: "100%"
|
|
818
|
+
},
|
|
819
|
+
ref: domRef
|
|
820
|
+
}, portals);
|
|
816
821
|
});
|
|
817
|
-
SplitviewReact.displayName =
|
|
822
|
+
SplitviewReact.displayName = "SplitviewComponent";
|
|
818
823
|
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
}
|
|
824
|
+
//#endregion
|
|
825
|
+
//#region src/gridview/view.ts
|
|
826
|
+
var ReactGridPanelView = class extends dockview.GridviewPanel {
|
|
827
|
+
constructor(id, component, reactComponent, reactPortalStore) {
|
|
828
|
+
super(id, component);
|
|
829
|
+
this.reactComponent = reactComponent;
|
|
830
|
+
this.reactPortalStore = reactPortalStore;
|
|
831
|
+
}
|
|
832
|
+
getComponent() {
|
|
833
|
+
var _this$_params$params, _this$_params;
|
|
834
|
+
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
835
|
+
params: (_this$_params$params = (_this$_params = this._params) === null || _this$_params === void 0 ? void 0 : _this$_params.params) !== null && _this$_params$params !== void 0 ? _this$_params$params : {},
|
|
836
|
+
api: this.api,
|
|
837
|
+
containerApi: new dockview.GridviewApi(this._params.accessor)
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
};
|
|
836
841
|
|
|
842
|
+
//#endregion
|
|
843
|
+
//#region src/gridview/gridview.tsx
|
|
837
844
|
function extractCoreOptions$1(props) {
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
return obj;
|
|
843
|
-
}, {});
|
|
844
|
-
return coreOptions;
|
|
845
|
+
return dockview.PROPERTY_KEYS_GRIDVIEW.reduce((obj, key) => {
|
|
846
|
+
if (key in props) obj[key] = props[key];
|
|
847
|
+
return obj;
|
|
848
|
+
}, {});
|
|
845
849
|
}
|
|
846
|
-
const GridviewReact =
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
React.useEffect(() => {
|
|
890
|
-
if (!gridviewRef.current) {
|
|
891
|
-
return;
|
|
892
|
-
}
|
|
893
|
-
gridviewRef.current.updateOptions({
|
|
894
|
-
createComponent: (options) => {
|
|
895
|
-
return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
|
|
896
|
-
},
|
|
897
|
-
});
|
|
898
|
-
}, [props.components]);
|
|
899
|
-
return (React.createElement("div", { style: { height: '100%', width: '100%' }, ref: domRef }, portals));
|
|
850
|
+
const GridviewReact = react.default.forwardRef((props, ref) => {
|
|
851
|
+
const domRef = react.default.useRef(null);
|
|
852
|
+
const gridviewRef = react.default.useRef(void 0);
|
|
853
|
+
const [portals, addPortal] = usePortalsLifecycle();
|
|
854
|
+
react.default.useImperativeHandle(ref, () => domRef.current, []);
|
|
855
|
+
const prevProps = react.default.useRef({});
|
|
856
|
+
react.default.useEffect(() => {
|
|
857
|
+
const changes = {};
|
|
858
|
+
dockview.PROPERTY_KEYS_GRIDVIEW.forEach((propKey) => {
|
|
859
|
+
const key = propKey;
|
|
860
|
+
const propValue = props[key];
|
|
861
|
+
if (key in props && propValue !== prevProps.current[key]) changes[key] = propValue;
|
|
862
|
+
});
|
|
863
|
+
if (gridviewRef.current) gridviewRef.current.updateOptions(changes);
|
|
864
|
+
prevProps.current = props;
|
|
865
|
+
}, dockview.PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));
|
|
866
|
+
react.default.useEffect(() => {
|
|
867
|
+
if (!domRef.current) return () => {};
|
|
868
|
+
const api = (0, dockview.createGridview)(domRef.current, _objectSpread2(_objectSpread2({}, extractCoreOptions$1(props)), { createComponent: (options) => {
|
|
869
|
+
return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
|
|
870
|
+
} }));
|
|
871
|
+
const { clientWidth, clientHeight } = domRef.current;
|
|
872
|
+
api.layout(clientWidth, clientHeight);
|
|
873
|
+
if (props.onReady) props.onReady({ api });
|
|
874
|
+
gridviewRef.current = api;
|
|
875
|
+
return () => {
|
|
876
|
+
gridviewRef.current = void 0;
|
|
877
|
+
api.dispose();
|
|
878
|
+
};
|
|
879
|
+
}, []);
|
|
880
|
+
react.default.useEffect(() => {
|
|
881
|
+
if (!gridviewRef.current) return;
|
|
882
|
+
gridviewRef.current.updateOptions({ createComponent: (options) => {
|
|
883
|
+
return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
|
|
884
|
+
} });
|
|
885
|
+
}, [props.components]);
|
|
886
|
+
return /* @__PURE__ */ react.default.createElement("div", {
|
|
887
|
+
style: {
|
|
888
|
+
height: "100%",
|
|
889
|
+
width: "100%"
|
|
890
|
+
},
|
|
891
|
+
ref: domRef
|
|
892
|
+
}, portals);
|
|
900
893
|
});
|
|
901
|
-
GridviewReact.displayName =
|
|
894
|
+
GridviewReact.displayName = "GridviewComponent";
|
|
902
895
|
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
}
|
|
896
|
+
//#endregion
|
|
897
|
+
//#region src/paneview/view.ts
|
|
898
|
+
var PanePanelSection = class {
|
|
899
|
+
get element() {
|
|
900
|
+
return this._element;
|
|
901
|
+
}
|
|
902
|
+
constructor(id, component, reactPortalStore) {
|
|
903
|
+
this.id = id;
|
|
904
|
+
this.component = component;
|
|
905
|
+
this.reactPortalStore = reactPortalStore;
|
|
906
|
+
this._element = document.createElement("div");
|
|
907
|
+
this._element.style.height = "100%";
|
|
908
|
+
this._element.style.width = "100%";
|
|
909
|
+
}
|
|
910
|
+
init(parameters) {
|
|
911
|
+
this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
|
|
912
|
+
params: parameters.params,
|
|
913
|
+
api: parameters.api,
|
|
914
|
+
title: parameters.title,
|
|
915
|
+
containerApi: parameters.containerApi
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
toJSON() {
|
|
919
|
+
return { id: this.id };
|
|
920
|
+
}
|
|
921
|
+
update(params) {
|
|
922
|
+
var _this$part;
|
|
923
|
+
(_this$part = this.part) === null || _this$part === void 0 || _this$part.update(params.params);
|
|
924
|
+
}
|
|
925
|
+
dispose() {
|
|
926
|
+
var _this$part2;
|
|
927
|
+
(_this$part2 = this.part) === null || _this$part2 === void 0 || _this$part2.dispose();
|
|
928
|
+
}
|
|
929
|
+
};
|
|
937
930
|
|
|
931
|
+
//#endregion
|
|
932
|
+
//#region src/paneview/paneview.tsx
|
|
938
933
|
function extractCoreOptions(props) {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
return obj;
|
|
944
|
-
}, {});
|
|
945
|
-
return coreOptions;
|
|
934
|
+
return dockview.PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
|
|
935
|
+
if (key in props) obj[key] = props[key];
|
|
936
|
+
return obj;
|
|
937
|
+
}, {});
|
|
946
938
|
}
|
|
947
|
-
const PaneviewReact =
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
},
|
|
1015
|
-
});
|
|
1016
|
-
}, [props.headerComponents]);
|
|
1017
|
-
React.useEffect(() => {
|
|
1018
|
-
if (!paneviewRef.current) {
|
|
1019
|
-
return () => {
|
|
1020
|
-
// noop
|
|
1021
|
-
};
|
|
1022
|
-
}
|
|
1023
|
-
const disposable = paneviewRef.current.onDidDrop((event) => {
|
|
1024
|
-
if (props.onDidDrop) {
|
|
1025
|
-
props.onDidDrop(event);
|
|
1026
|
-
}
|
|
1027
|
-
});
|
|
1028
|
-
return () => {
|
|
1029
|
-
disposable.dispose();
|
|
1030
|
-
};
|
|
1031
|
-
}, [props.onDidDrop]);
|
|
1032
|
-
return (React.createElement("div", { style: { height: '100%', width: '100%' }, ref: domRef }, portals));
|
|
939
|
+
const PaneviewReact = react.default.forwardRef((props, ref) => {
|
|
940
|
+
const domRef = react.default.useRef(null);
|
|
941
|
+
const paneviewRef = react.default.useRef(void 0);
|
|
942
|
+
const [portals, addPortal] = usePortalsLifecycle();
|
|
943
|
+
react.default.useImperativeHandle(ref, () => domRef.current, []);
|
|
944
|
+
const prevProps = react.default.useRef({});
|
|
945
|
+
react.default.useEffect(() => {
|
|
946
|
+
const changes = {};
|
|
947
|
+
dockview.PROPERTY_KEYS_PANEVIEW.forEach((propKey) => {
|
|
948
|
+
const key = propKey;
|
|
949
|
+
const propValue = props[key];
|
|
950
|
+
if (key in props && propValue !== prevProps.current[key]) changes[key] = propValue;
|
|
951
|
+
});
|
|
952
|
+
if (paneviewRef.current) paneviewRef.current.updateOptions(changes);
|
|
953
|
+
prevProps.current = props;
|
|
954
|
+
}, dockview.PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));
|
|
955
|
+
react.default.useEffect(() => {
|
|
956
|
+
var _props$headerComponen;
|
|
957
|
+
if (!domRef.current) return () => {};
|
|
958
|
+
const headerComponents = (_props$headerComponen = props.headerComponents) !== null && _props$headerComponen !== void 0 ? _props$headerComponen : {};
|
|
959
|
+
const api = (0, dockview.createPaneview)(domRef.current, _objectSpread2(_objectSpread2({}, extractCoreOptions(props)), {
|
|
960
|
+
createComponent: (options) => {
|
|
961
|
+
return new PanePanelSection(options.id, props.components[options.name], { addPortal });
|
|
962
|
+
},
|
|
963
|
+
createHeaderComponent: (options) => {
|
|
964
|
+
return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
|
|
965
|
+
}
|
|
966
|
+
}));
|
|
967
|
+
const { clientWidth, clientHeight } = domRef.current;
|
|
968
|
+
api.layout(clientWidth, clientHeight);
|
|
969
|
+
if (props.onReady) props.onReady({ api });
|
|
970
|
+
paneviewRef.current = api;
|
|
971
|
+
return () => {
|
|
972
|
+
paneviewRef.current = void 0;
|
|
973
|
+
api.dispose();
|
|
974
|
+
};
|
|
975
|
+
}, []);
|
|
976
|
+
react.default.useEffect(() => {
|
|
977
|
+
if (!paneviewRef.current) return;
|
|
978
|
+
paneviewRef.current.updateOptions({ createComponent: (options) => {
|
|
979
|
+
return new PanePanelSection(options.id, props.components[options.name], { addPortal });
|
|
980
|
+
} });
|
|
981
|
+
}, [props.components]);
|
|
982
|
+
react.default.useEffect(() => {
|
|
983
|
+
var _props$headerComponen2;
|
|
984
|
+
if (!paneviewRef.current) return;
|
|
985
|
+
const headerComponents = (_props$headerComponen2 = props.headerComponents) !== null && _props$headerComponen2 !== void 0 ? _props$headerComponen2 : {};
|
|
986
|
+
paneviewRef.current.updateOptions({ createHeaderComponent: (options) => {
|
|
987
|
+
return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
|
|
988
|
+
} });
|
|
989
|
+
}, [props.headerComponents]);
|
|
990
|
+
react.default.useEffect(() => {
|
|
991
|
+
if (!paneviewRef.current) return () => {};
|
|
992
|
+
const disposable = paneviewRef.current.onDidDrop((event) => {
|
|
993
|
+
if (props.onDidDrop) props.onDidDrop(event);
|
|
994
|
+
});
|
|
995
|
+
return () => {
|
|
996
|
+
disposable.dispose();
|
|
997
|
+
};
|
|
998
|
+
}, [props.onDidDrop]);
|
|
999
|
+
return /* @__PURE__ */ react.default.createElement("div", {
|
|
1000
|
+
style: {
|
|
1001
|
+
height: "100%",
|
|
1002
|
+
width: "100%"
|
|
1003
|
+
},
|
|
1004
|
+
ref: domRef
|
|
1005
|
+
}, portals);
|
|
1033
1006
|
});
|
|
1034
|
-
PaneviewReact.displayName =
|
|
1007
|
+
PaneviewReact.displayName = "PaneviewComponent";
|
|
1035
1008
|
|
|
1009
|
+
//#endregion
|
|
1036
1010
|
exports.DockviewDefaultTab = DockviewDefaultTab;
|
|
1037
1011
|
exports.DockviewReact = DockviewReact;
|
|
1038
1012
|
exports.GridviewReact = GridviewReact;
|
|
@@ -1043,8 +1017,8 @@ exports.SplitviewReact = SplitviewReact;
|
|
|
1043
1017
|
exports.isReactComponent = isReactComponent;
|
|
1044
1018
|
exports.usePortalsLifecycle = usePortalsLifecycle;
|
|
1045
1019
|
Object.keys(dockview).forEach(function (k) {
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1020
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
1021
|
+
enumerable: true,
|
|
1022
|
+
get: function () { return dockview[k]; }
|
|
1023
|
+
});
|
|
1050
1024
|
});
|