dockview 1.4.0 → 1.4.3
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 +4 -195
- package/dist/cjs/api/component.api.d.ts +8 -8
- package/dist/cjs/api/component.api.js +16 -19
- package/dist/cjs/api/component.api.js.map +1 -1
- package/dist/cjs/api/panelApi.d.ts +1 -2
- package/dist/cjs/api/panelApi.js +3 -3
- package/dist/cjs/api/panelApi.js.map +1 -1
- package/dist/cjs/dnd/droptarget.d.ts +1 -2
- package/dist/cjs/dockview/components/tab/defaultTab.d.ts +0 -17
- package/dist/cjs/dockview/components/tab/defaultTab.js +9 -64
- package/dist/cjs/dockview/components/tab/defaultTab.js.map +1 -1
- package/dist/cjs/dockview/defaultGroupPanelView.d.ts +1 -2
- package/dist/cjs/dockview/defaultGroupPanelView.js +2 -4
- package/dist/cjs/dockview/defaultGroupPanelView.js.map +1 -1
- package/dist/cjs/dockview/deserializer.d.ts +0 -12
- package/dist/cjs/dockview/deserializer.js +0 -52
- package/dist/cjs/dockview/deserializer.js.map +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts +5 -7
- package/dist/cjs/dockview/dockviewComponent.js +79 -42
- package/dist/cjs/dockview/dockviewComponent.js.map +1 -1
- package/dist/cjs/dockview/dockviewGroupPanel.js +1 -1
- package/dist/cjs/dockview/dockviewGroupPanel.js.map +1 -1
- package/dist/cjs/dockview/options.d.ts +6 -1
- package/dist/cjs/gridview/baseComponentGridview.d.ts +4 -2
- package/dist/cjs/gridview/baseComponentGridview.js +1 -1
- package/dist/cjs/gridview/baseComponentGridview.js.map +1 -1
- package/dist/cjs/gridview/basePanelView.js +1 -1
- package/dist/cjs/gridview/basePanelView.js.map +1 -1
- package/dist/cjs/gridview/gridview.js +1 -1
- package/dist/cjs/gridview/gridview.js.map +1 -1
- package/dist/cjs/gridview/gridviewComponent.d.ts +1 -2
- package/dist/cjs/gridview/gridviewComponent.js +28 -24
- package/dist/cjs/gridview/gridviewComponent.js.map +1 -1
- package/dist/cjs/gridview/gridviewPanel.d.ts +2 -3
- package/dist/cjs/gridview/gridviewPanel.js +4 -4
- package/dist/cjs/gridview/gridviewPanel.js.map +1 -1
- package/dist/cjs/groupview/groupview.d.ts +4 -3
- package/dist/cjs/groupview/groupview.js +20 -8
- package/dist/cjs/groupview/groupview.js.map +1 -1
- package/dist/cjs/groupview/groupviewPanel.d.ts +2 -2
- package/dist/cjs/groupview/groupviewPanel.js.map +1 -1
- package/dist/cjs/groupview/tab.js +1 -0
- package/dist/cjs/groupview/tab.js.map +1 -1
- package/dist/cjs/groupview/titlebar/tabsContainer.d.ts +3 -5
- package/dist/cjs/groupview/titlebar/tabsContainer.js +2 -4
- package/dist/cjs/groupview/titlebar/tabsContainer.js.map +1 -1
- package/dist/cjs/groupview/types.d.ts +1 -3
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/paneview/defaultPaneviewHeader.js +6 -4
- package/dist/cjs/paneview/defaultPaneviewHeader.js.map +1 -1
- package/dist/cjs/paneview/paneviewComponent.d.ts +2 -0
- package/dist/cjs/paneview/paneviewComponent.js +20 -17
- package/dist/cjs/paneview/paneviewComponent.js.map +1 -1
- package/dist/cjs/react/dockview/dockview.d.ts +2 -3
- package/dist/cjs/react/dockview/dockview.js.map +1 -1
- package/dist/cjs/react/dockview/reactContentPart.d.ts +2 -4
- package/dist/cjs/react/dockview/reactContentPart.js +0 -3
- package/dist/cjs/react/dockview/reactContentPart.js.map +1 -1
- package/dist/cjs/react/dockview/v2/reactContentRenderer.d.ts +0 -1
- package/dist/cjs/react/dockview/v2/reactContentRenderer.js +0 -3
- package/dist/cjs/react/dockview/v2/reactContentRenderer.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 +0 -1
- package/dist/cjs/react/index.js +0 -1
- package/dist/cjs/react/index.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/options.d.ts +2 -2
- package/dist/cjs/splitview/splitviewComponent.d.ts +2 -1
- package/dist/cjs/splitview/splitviewComponent.js +23 -21
- package/dist/cjs/splitview/splitviewComponent.js.map +1 -1
- package/dist/cjs/splitview/splitviewPanel.js +4 -6
- package/dist/cjs/splitview/splitviewPanel.js.map +1 -1
- package/dist/dockview.amd.js +165 -250
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.noStyle.js +164 -249
- package/dist/dockview.cjs.js +165 -250
- package/dist/dockview.esm.js +160 -244
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.js +165 -250
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.noStyle.js +164 -249
- package/dist/esm/api/component.api.d.ts +8 -8
- package/dist/esm/api/component.api.js +16 -19
- package/dist/esm/api/panelApi.d.ts +1 -2
- package/dist/esm/api/panelApi.js +3 -3
- package/dist/esm/dnd/droptarget.d.ts +1 -2
- package/dist/esm/dockview/components/tab/defaultTab.d.ts +0 -17
- package/dist/esm/dockview/components/tab/defaultTab.js +8 -49
- package/dist/esm/dockview/defaultGroupPanelView.d.ts +1 -2
- package/dist/esm/dockview/defaultGroupPanelView.js +3 -5
- package/dist/esm/dockview/deserializer.d.ts +0 -12
- package/dist/esm/dockview/deserializer.js +1 -27
- package/dist/esm/dockview/dockviewComponent.d.ts +5 -7
- package/dist/esm/dockview/dockviewComponent.js +50 -24
- package/dist/esm/dockview/dockviewGroupPanel.js +1 -1
- package/dist/esm/dockview/options.d.ts +6 -1
- package/dist/esm/gridview/baseComponentGridview.d.ts +4 -2
- package/dist/esm/gridview/baseComponentGridview.js +1 -1
- package/dist/esm/gridview/basePanelView.js +1 -1
- package/dist/esm/gridview/gridviewComponent.d.ts +1 -2
- package/dist/esm/gridview/gridviewComponent.js +17 -13
- package/dist/esm/gridview/gridviewPanel.d.ts +2 -3
- package/dist/esm/gridview/gridviewPanel.js +4 -4
- package/dist/esm/groupview/groupview.d.ts +4 -3
- package/dist/esm/groupview/groupview.js +19 -8
- package/dist/esm/groupview/groupviewPanel.d.ts +2 -2
- package/dist/esm/groupview/tab.js +1 -0
- package/dist/esm/groupview/titlebar/tabsContainer.d.ts +3 -5
- package/dist/esm/groupview/titlebar/tabsContainer.js +2 -4
- package/dist/esm/groupview/types.d.ts +1 -3
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/paneview/defaultPaneviewHeader.js +6 -4
- package/dist/esm/paneview/paneviewComponent.d.ts +2 -0
- package/dist/esm/paneview/paneviewComponent.js +8 -5
- package/dist/esm/react/dockview/dockview.d.ts +2 -3
- package/dist/esm/react/dockview/reactContentPart.d.ts +2 -4
- package/dist/esm/react/dockview/reactContentPart.js +0 -3
- package/dist/esm/react/dockview/v2/reactContentRenderer.d.ts +0 -1
- package/dist/esm/react/dockview/v2/reactContentRenderer.js +0 -3
- package/dist/esm/react/gridview/view.js +2 -2
- package/dist/esm/react/index.d.ts +0 -1
- package/dist/esm/react/index.js +0 -1
- package/dist/esm/react/splitview/view.js +2 -2
- package/dist/esm/splitview/core/options.d.ts +2 -2
- package/dist/esm/splitview/splitviewComponent.d.ts +2 -1
- package/dist/esm/splitview/splitviewComponent.js +11 -9
- package/dist/esm/splitview/splitviewPanel.js +4 -6
- package/dist/styles/dockview.css +5 -0
- package/package.json +2 -2
- package/dist/cjs/react/dockview/components.d.ts +0 -11
- package/dist/cjs/react/dockview/components.js +0 -81
- package/dist/cjs/react/dockview/components.js.map +0 -1
- package/dist/esm/react/dockview/components.d.ts +0 -11
- package/dist/esm/react/dockview/components.js +0 -54
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CompositeDisposable, MutableDisposable, } from '../lifecycle';
|
|
2
2
|
import { Orientation, Sizing, Splitview, } from './core/splitview';
|
|
3
3
|
import { Emitter } from '../events';
|
|
4
|
-
import { SplitviewApi } from '../api/component.api';
|
|
5
4
|
import { createComponent } from '../panel/componentFactory';
|
|
6
5
|
/**
|
|
7
6
|
* A high-level implementation of splitview that works using 'panels'
|
|
@@ -136,7 +135,7 @@ export class SplitviewComponent extends CompositeDisposable {
|
|
|
136
135
|
maximumSize: options.maximumSize,
|
|
137
136
|
snap: options.snap,
|
|
138
137
|
priority: options.priority,
|
|
139
|
-
|
|
138
|
+
accessor: this,
|
|
140
139
|
});
|
|
141
140
|
const size = typeof options.size === 'number' ? options.size : Sizing.Distribute;
|
|
142
141
|
const index = typeof options.index === 'number' ? options.index : undefined;
|
|
@@ -181,13 +180,8 @@ export class SplitviewComponent extends CompositeDisposable {
|
|
|
181
180
|
};
|
|
182
181
|
}
|
|
183
182
|
fromJSON(serializedSplitview) {
|
|
183
|
+
this.clear();
|
|
184
184
|
const { views, orientation, size, activeView } = serializedSplitview;
|
|
185
|
-
for (const [_, value] of this._panels.entries()) {
|
|
186
|
-
value.disposable.dispose();
|
|
187
|
-
value.value.dispose();
|
|
188
|
-
}
|
|
189
|
-
this._panels.clear();
|
|
190
|
-
this.splitview.dispose();
|
|
191
185
|
const queue = [];
|
|
192
186
|
this.splitview = new Splitview(this.element, {
|
|
193
187
|
orientation,
|
|
@@ -212,7 +206,7 @@ export class SplitviewComponent extends CompositeDisposable {
|
|
|
212
206
|
maximumSize: data.maximumSize,
|
|
213
207
|
snap: view.snap,
|
|
214
208
|
priority: view.priority,
|
|
215
|
-
|
|
209
|
+
accessor: this,
|
|
216
210
|
});
|
|
217
211
|
});
|
|
218
212
|
panel.orientation = orientation;
|
|
@@ -235,6 +229,14 @@ export class SplitviewComponent extends CompositeDisposable {
|
|
|
235
229
|
}
|
|
236
230
|
this._onDidLayoutfromJSON.fire();
|
|
237
231
|
}
|
|
232
|
+
clear() {
|
|
233
|
+
for (const [_, value] of this._panels.entries()) {
|
|
234
|
+
value.disposable.dispose();
|
|
235
|
+
value.value.dispose();
|
|
236
|
+
}
|
|
237
|
+
this._panels.clear();
|
|
238
|
+
this.splitview.dispose();
|
|
239
|
+
}
|
|
238
240
|
dispose() {
|
|
239
241
|
for (const [_, value] of this._panels.entries()) {
|
|
240
242
|
value.disposable.dispose();
|
|
@@ -14,13 +14,11 @@ export class SplitviewPanel extends BasePanelView {
|
|
|
14
14
|
this.onDidChange = this._onDidChange.event;
|
|
15
15
|
this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
|
|
16
16
|
const { isVisible } = event;
|
|
17
|
-
const {
|
|
18
|
-
|
|
19
|
-
containerApi.setVisible(this, isVisible);
|
|
17
|
+
const { accessor } = this._params;
|
|
18
|
+
accessor.setVisible(this, isVisible);
|
|
20
19
|
}), this.api.onActiveChange(() => {
|
|
21
|
-
const {
|
|
22
|
-
|
|
23
|
-
containerApi.setActive(this);
|
|
20
|
+
const { accessor } = this._params;
|
|
21
|
+
accessor.setActive(this);
|
|
24
22
|
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
25
23
|
if (typeof event.minimumSize === 'number' ||
|
|
26
24
|
typeof event.minimumSize === 'function') {
|
package/dist/styles/dockview.css
CHANGED
|
@@ -244,8 +244,13 @@
|
|
|
244
244
|
color: var(--dv-activegroup-visiblepanel-tab-color);
|
|
245
245
|
display: flex;
|
|
246
246
|
padding: 0px 8px;
|
|
247
|
+
cursor: pointer;
|
|
248
|
+
}
|
|
249
|
+
.pane-container .view .default-header .collapsed {
|
|
250
|
+
transform: rotate(-90deg);
|
|
247
251
|
}
|
|
248
252
|
.pane-container .view .default-header > span {
|
|
253
|
+
padding-left: 8px;
|
|
249
254
|
flex-grow: 1;
|
|
250
255
|
}
|
|
251
256
|
.pane-container:first-of-type > .pane > .pane-header {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dockview",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "Zero dependency layout manager supporting tabs, grids and splitviews with ReactJS support",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"types": "./dist/cjs/index.d.ts",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
75
75
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "95c7b1a624f19b37fc8ec13531d7d6f4f54a3164"
|
|
78
78
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
interface WithChildren {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
}
|
|
5
|
-
export declare const DockviewComponents: {
|
|
6
|
-
Tab: React.FunctionComponent<WithChildren>;
|
|
7
|
-
Content: React.FunctionComponent<WithChildren>;
|
|
8
|
-
Actions: React.FunctionComponent<WithChildren>;
|
|
9
|
-
Panel: React.FunctionComponent<WithChildren>;
|
|
10
|
-
};
|
|
11
|
-
export {};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.DockviewComponents = void 0;
|
|
27
|
-
var React = __importStar(require("react"));
|
|
28
|
-
var ReactDOM = __importStar(require("react-dom"));
|
|
29
|
-
var react_1 = require("../react");
|
|
30
|
-
var Tab = function (props) {
|
|
31
|
-
return React.createElement(React.Fragment, null, props.children);
|
|
32
|
-
};
|
|
33
|
-
var Content = function (props) {
|
|
34
|
-
return React.createElement(React.Fragment, null, props.children);
|
|
35
|
-
};
|
|
36
|
-
var Actions = function (props) {
|
|
37
|
-
return React.createElement(React.Fragment, null, props.children);
|
|
38
|
-
};
|
|
39
|
-
function isValidComponent(element) {
|
|
40
|
-
return [Content, Actions, Tab].find(function (comp) { return element.type === comp; });
|
|
41
|
-
}
|
|
42
|
-
var Panel = function (props) {
|
|
43
|
-
var context = React.useContext(react_1.ReactPartContext);
|
|
44
|
-
var sections = React.useMemo(function () {
|
|
45
|
-
var _a;
|
|
46
|
-
var childs = ((_a = React.Children.map(props.children, function (_) { return _; })) === null || _a === void 0 ? void 0 : _a.filter(react_1.isReactElement)) || [];
|
|
47
|
-
var isInvalid = !!childs.find(function (_) { return !isValidComponent(_); });
|
|
48
|
-
if (isInvalid) {
|
|
49
|
-
throw new Error('Children of DockviewComponents.Panel must be one of the following: DockviewComponents.Content, DockviewComponents.Actions, DockviewComponents.Tab');
|
|
50
|
-
}
|
|
51
|
-
var body = childs.find(function (_) { return _.type === Content; });
|
|
52
|
-
var actions = childs.find(function (_) { return _.type === Actions; });
|
|
53
|
-
var tab = childs.find(function (_) { return _.type === Tab; });
|
|
54
|
-
return { body: body, actions: actions, tab: tab };
|
|
55
|
-
}, [props.children]);
|
|
56
|
-
React.useEffect(function () {
|
|
57
|
-
/**
|
|
58
|
-
* hide or show the default tab behavior based on whether we want to override
|
|
59
|
-
* with our own React tab.
|
|
60
|
-
*/
|
|
61
|
-
if (sections.tab) {
|
|
62
|
-
context.tabPortalElement.hide();
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
context.tabPortalElement.show();
|
|
66
|
-
}
|
|
67
|
-
}, [sections.tab]);
|
|
68
|
-
return (React.createElement(React.Fragment, null,
|
|
69
|
-
sections.actions &&
|
|
70
|
-
ReactDOM.createPortal(sections.actions, context.actionsPortalElement),
|
|
71
|
-
sections.tab &&
|
|
72
|
-
ReactDOM.createPortal(sections.tab, context.tabPortalElement.element),
|
|
73
|
-
sections.body || props.children));
|
|
74
|
-
};
|
|
75
|
-
exports.DockviewComponents = {
|
|
76
|
-
Tab: Tab,
|
|
77
|
-
Content: Content,
|
|
78
|
-
Actions: Actions,
|
|
79
|
-
Panel: Panel,
|
|
80
|
-
};
|
|
81
|
-
//# sourceMappingURL=components.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../../../src/react/dockview/components.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA+B;AAC/B,kDAAsC;AACtC,kCAA4D;AAO5D,IAAM,GAAG,GAA0C,UAAC,KAAmB;IACnE,OAAO,0CAAG,KAAK,CAAC,QAAQ,CAAI,CAAC;AACjC,CAAC,CAAC;AAEF,IAAM,OAAO,GAA0C,UACnD,KAAmB;IAEnB,OAAO,0CAAG,KAAK,CAAC,QAAQ,CAAI,CAAC;AACjC,CAAC,CAAC;AACF,IAAM,OAAO,GAA0C,UACnD,KAAmB;IAEnB,OAAO,0CAAG,KAAK,CAAC,QAAQ,CAAI,CAAC;AACjC,CAAC,CAAC;AAEF,SAAS,gBAAgB,CAAC,OAA2B;IACjD,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,UAAC,IAAI,IAAK,OAAA,OAAO,CAAC,IAAI,KAAK,IAAI,EAArB,CAAqB,CAAC,CAAC;AACzE,CAAC;AAED,IAAM,KAAK,GAA0C,UAAC,KAAmB;IACrE,IAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAC5B,wBAAgB,CACQ,CAAC;IAE7B,IAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;;QAC3B,IAAM,MAAM,GACR,CAAA,MAAA,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAC,CAAC,IAAK,OAAA,CAAC,EAAD,CAAC,CAAC,0CAAE,MAAM,CAChD,sBAAc,CACjB,KAAI,EAAE,CAAC;QAEZ,IAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAApB,CAAoB,CAAC,CAAC;QAE7D,IAAI,SAAS,EAAE;YACX,MAAM,IAAI,KAAK,CACX,mJAAmJ,CACtJ,CAAC;SACL;QAED,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,KAAK,OAAO,EAAlB,CAAkB,CAAC,CAAC;QACpD,IAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,KAAK,OAAO,EAAlB,CAAkB,CAAC,CAAC;QACvD,IAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,KAAK,GAAG,EAAd,CAAc,CAAC,CAAC;QAE/C,OAAO,EAAE,IAAI,MAAA,EAAE,OAAO,SAAA,EAAE,GAAG,KAAA,EAAE,CAAC;IAClC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAErB,KAAK,CAAC,SAAS,CAAC;QACZ;;;WAGG;QACH,IAAI,QAAQ,CAAC,GAAG,EAAE;YACd,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;SACnC;aAAM;YACH,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;SACnC;IACL,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAEnB,OAAO,CACH;QACK,QAAQ,CAAC,OAAO;YACb,QAAQ,CAAC,YAAY,CACjB,QAAQ,CAAC,OAAO,EAChB,OAAO,CAAC,oBAAoB,CAC/B;QACJ,QAAQ,CAAC,GAAG;YACT,QAAQ,CAAC,YAAY,CACjB,QAAQ,CAAC,GAAG,EACZ,OAAO,CAAC,gBAAgB,CAAC,OAAO,CACnC;QACJ,QAAQ,CAAC,IAAI,IAAI,KAAK,CAAC,QAAQ,CACjC,CACN,CAAC;AACN,CAAC,CAAC;AAEW,QAAA,kBAAkB,GAAG;IAC9B,GAAG,KAAA;IACH,OAAO,SAAA;IACP,OAAO,SAAA;IACP,KAAK,OAAA;CACR,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
interface WithChildren {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
}
|
|
5
|
-
export declare const DockviewComponents: {
|
|
6
|
-
Tab: React.FunctionComponent<WithChildren>;
|
|
7
|
-
Content: React.FunctionComponent<WithChildren>;
|
|
8
|
-
Actions: React.FunctionComponent<WithChildren>;
|
|
9
|
-
Panel: React.FunctionComponent<WithChildren>;
|
|
10
|
-
};
|
|
11
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as ReactDOM from 'react-dom';
|
|
3
|
-
import { isReactElement, ReactPartContext } from '../react';
|
|
4
|
-
const Tab = (props) => {
|
|
5
|
-
return React.createElement(React.Fragment, null, props.children);
|
|
6
|
-
};
|
|
7
|
-
const Content = (props) => {
|
|
8
|
-
return React.createElement(React.Fragment, null, props.children);
|
|
9
|
-
};
|
|
10
|
-
const Actions = (props) => {
|
|
11
|
-
return React.createElement(React.Fragment, null, props.children);
|
|
12
|
-
};
|
|
13
|
-
function isValidComponent(element) {
|
|
14
|
-
return [Content, Actions, Tab].find((comp) => element.type === comp);
|
|
15
|
-
}
|
|
16
|
-
const Panel = (props) => {
|
|
17
|
-
const context = React.useContext(ReactPartContext);
|
|
18
|
-
const sections = React.useMemo(() => {
|
|
19
|
-
var _a;
|
|
20
|
-
const childs = ((_a = React.Children.map(props.children, (_) => _)) === null || _a === void 0 ? void 0 : _a.filter(isReactElement)) || [];
|
|
21
|
-
const isInvalid = !!childs.find((_) => !isValidComponent(_));
|
|
22
|
-
if (isInvalid) {
|
|
23
|
-
throw new Error('Children of DockviewComponents.Panel must be one of the following: DockviewComponents.Content, DockviewComponents.Actions, DockviewComponents.Tab');
|
|
24
|
-
}
|
|
25
|
-
const body = childs.find((_) => _.type === Content);
|
|
26
|
-
const actions = childs.find((_) => _.type === Actions);
|
|
27
|
-
const tab = childs.find((_) => _.type === Tab);
|
|
28
|
-
return { body, actions, tab };
|
|
29
|
-
}, [props.children]);
|
|
30
|
-
React.useEffect(() => {
|
|
31
|
-
/**
|
|
32
|
-
* hide or show the default tab behavior based on whether we want to override
|
|
33
|
-
* with our own React tab.
|
|
34
|
-
*/
|
|
35
|
-
if (sections.tab) {
|
|
36
|
-
context.tabPortalElement.hide();
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
context.tabPortalElement.show();
|
|
40
|
-
}
|
|
41
|
-
}, [sections.tab]);
|
|
42
|
-
return (React.createElement(React.Fragment, null,
|
|
43
|
-
sections.actions &&
|
|
44
|
-
ReactDOM.createPortal(sections.actions, context.actionsPortalElement),
|
|
45
|
-
sections.tab &&
|
|
46
|
-
ReactDOM.createPortal(sections.tab, context.tabPortalElement.element),
|
|
47
|
-
sections.body || props.children));
|
|
48
|
-
};
|
|
49
|
-
export const DockviewComponents = {
|
|
50
|
-
Tab,
|
|
51
|
-
Content,
|
|
52
|
-
Actions,
|
|
53
|
-
Panel,
|
|
54
|
-
};
|