dockview-react 6.6.1 → 7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/dockview/defaultTab.d.ts +7 -0
- package/dist/cjs/dockview/defaultTab.js +99 -0
- package/dist/cjs/dockview/dockview.d.ts +33 -0
- package/dist/cjs/dockview/dockview.js +285 -0
- package/dist/cjs/dockview/headerActionsRenderer.d.ts +24 -0
- package/dist/cjs/dockview/headerActionsRenderer.js +86 -0
- package/dist/cjs/dockview/reactContentPart.d.ts +21 -0
- package/dist/cjs/dockview/reactContentPart.js +52 -0
- package/dist/cjs/dockview/reactContextMenuItemPart.d.ts +14 -0
- package/dist/cjs/dockview/reactContextMenuItemPart.js +31 -0
- package/dist/cjs/dockview/reactGroupDragGhostPart.d.ts +20 -0
- package/dist/cjs/dockview/reactGroupDragGhostPart.js +32 -0
- package/dist/cjs/dockview/reactHeaderPart.d.ts +17 -0
- package/dist/cjs/dockview/reactHeaderPart.js +46 -0
- package/dist/cjs/dockview/reactTabGroupChipPart.d.ts +23 -0
- package/dist/cjs/dockview/reactTabGroupChipPart.js +36 -0
- package/dist/cjs/dockview/reactWatermarkPart.d.ts +18 -0
- package/dist/cjs/dockview/reactWatermarkPart.js +47 -0
- package/dist/cjs/gridview/gridview.d.ts +17 -0
- package/dist/cjs/gridview/gridview.js +105 -0
- package/dist/cjs/gridview/view.d.ts +9 -0
- package/dist/cjs/gridview/view.js +41 -0
- package/dist/cjs/index.d.ts +9 -0
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/paneview/paneview.d.ts +20 -0
- package/dist/cjs/paneview/paneview.js +137 -0
- package/dist/cjs/paneview/view.d.ts +19 -0
- package/dist/cjs/paneview/view.js +44 -0
- package/dist/cjs/react.d.ts +35 -0
- package/dist/cjs/react.js +183 -0
- package/dist/cjs/splitview/splitview.d.ts +17 -0
- package/dist/cjs/splitview/splitview.js +105 -0
- package/dist/cjs/splitview/view.d.ts +9 -0
- package/dist/cjs/splitview/view.js +39 -0
- package/dist/cjs/svg.d.ts +3 -0
- package/dist/cjs/svg.js +15 -0
- package/dist/cjs/types.d.ts +4 -0
- package/dist/cjs/types.js +2 -0
- package/dist/dockview-react.js +21650 -11
- package/dist/dockview-react.min.js +21 -2
- package/dist/dockview-react.min.js.map +1 -1
- package/dist/esm/dockview/defaultTab.d.ts +7 -0
- package/dist/esm/dockview/defaultTab.js +65 -0
- package/dist/esm/dockview/dockview.d.ts +33 -0
- package/dist/esm/dockview/dockview.js +252 -0
- package/dist/esm/dockview/headerActionsRenderer.d.ts +24 -0
- package/dist/esm/dockview/headerActionsRenderer.js +72 -0
- package/dist/esm/dockview/reactContentPart.d.ts +21 -0
- package/dist/esm/dockview/reactContentPart.js +43 -0
- package/dist/esm/dockview/reactContextMenuItemPart.d.ts +14 -0
- package/dist/esm/dockview/reactContextMenuItemPart.js +22 -0
- package/dist/esm/dockview/reactGroupDragGhostPart.d.ts +20 -0
- package/dist/esm/dockview/reactGroupDragGhostPart.js +23 -0
- package/dist/esm/dockview/reactHeaderPart.d.ts +17 -0
- package/dist/esm/dockview/reactHeaderPart.js +37 -0
- package/dist/esm/dockview/reactTabGroupChipPart.d.ts +23 -0
- package/dist/esm/dockview/reactTabGroupChipPart.js +27 -0
- package/dist/esm/dockview/reactWatermarkPart.d.ts +18 -0
- package/dist/esm/dockview/reactWatermarkPart.js +38 -0
- package/dist/esm/gridview/gridview.d.ts +17 -0
- package/dist/esm/gridview/gridview.js +72 -0
- package/dist/esm/gridview/view.d.ts +9 -0
- package/dist/esm/gridview/view.js +19 -0
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/paneview/paneview.d.ts +20 -0
- package/dist/esm/paneview/paneview.js +104 -0
- package/dist/esm/paneview/view.d.ts +19 -0
- package/dist/esm/paneview/view.js +35 -0
- package/dist/esm/react.d.ts +35 -0
- package/dist/esm/react.js +134 -0
- package/dist/esm/splitview/splitview.d.ts +17 -0
- package/dist/esm/splitview/splitview.js +72 -0
- package/dist/esm/splitview/view.d.ts +9 -0
- package/dist/esm/splitview/view.js +17 -0
- package/dist/esm/svg.d.ts +3 -0
- package/dist/esm/svg.js +7 -0
- package/dist/esm/types.d.ts +4 -0
- package/dist/esm/types.js +1 -0
- package/dist/package/main.cjs.js +1037 -5
- package/dist/package/main.cjs.min.js +2 -2
- package/dist/package/main.esm.min.mjs +2 -8
- package/dist/package/main.esm.mjs +1027 -1
- package/dist/styles/dockview.css +275 -13
- package/package.json +15 -2
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createSplitview, PROPERTY_KEYS_SPLITVIEW, } from 'dockview';
|
|
3
|
+
import { usePortalsLifecycle } from '../react';
|
|
4
|
+
import { ReactPanelView } from './view';
|
|
5
|
+
function extractCoreOptions(props) {
|
|
6
|
+
const coreOptions = PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {
|
|
7
|
+
if (key in props) {
|
|
8
|
+
obj[key] = props[key];
|
|
9
|
+
}
|
|
10
|
+
return obj;
|
|
11
|
+
}, {});
|
|
12
|
+
return coreOptions;
|
|
13
|
+
}
|
|
14
|
+
export const SplitviewReact = React.forwardRef((props, ref) => {
|
|
15
|
+
const domRef = React.useRef(null);
|
|
16
|
+
const splitviewRef = React.useRef(undefined);
|
|
17
|
+
const [portals, addPortal] = usePortalsLifecycle();
|
|
18
|
+
React.useImperativeHandle(ref, () => domRef.current, []);
|
|
19
|
+
const prevProps = React.useRef({});
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
const changes = {};
|
|
22
|
+
PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {
|
|
23
|
+
const key = propKey;
|
|
24
|
+
const propValue = props[key];
|
|
25
|
+
if (key in props && propValue !== prevProps.current[key]) {
|
|
26
|
+
changes[key] = propValue;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
if (splitviewRef.current) {
|
|
30
|
+
splitviewRef.current.updateOptions(changes);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
// not yet fully initialized
|
|
34
|
+
}
|
|
35
|
+
prevProps.current = props;
|
|
36
|
+
}, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
|
|
37
|
+
React.useEffect(() => {
|
|
38
|
+
if (!domRef.current) {
|
|
39
|
+
return () => {
|
|
40
|
+
// noop
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const frameworkOptions = {
|
|
44
|
+
createComponent: (options) => {
|
|
45
|
+
return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
const api = createSplitview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
|
|
49
|
+
const { clientWidth, clientHeight } = domRef.current;
|
|
50
|
+
api.layout(clientWidth, clientHeight);
|
|
51
|
+
if (props.onReady) {
|
|
52
|
+
props.onReady({ api });
|
|
53
|
+
}
|
|
54
|
+
splitviewRef.current = api;
|
|
55
|
+
return () => {
|
|
56
|
+
splitviewRef.current = undefined;
|
|
57
|
+
api.dispose();
|
|
58
|
+
};
|
|
59
|
+
}, []);
|
|
60
|
+
React.useEffect(() => {
|
|
61
|
+
if (!splitviewRef.current) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
splitviewRef.current.updateOptions({
|
|
65
|
+
createComponent: (options) => {
|
|
66
|
+
return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}, [props.components]);
|
|
70
|
+
return (React.createElement("div", { style: { height: '100%', width: '100%' }, ref: domRef }, portals));
|
|
71
|
+
});
|
|
72
|
+
SplitviewReact.displayName = 'SplitviewComponent';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SplitviewPanel } from 'dockview';
|
|
2
|
+
import { ReactPart, ReactPortalStore } from '../react';
|
|
3
|
+
import { ISplitviewPanelProps } from './splitview';
|
|
4
|
+
export declare class ReactPanelView extends SplitviewPanel {
|
|
5
|
+
private readonly reactComponent;
|
|
6
|
+
private readonly reactPortalStore;
|
|
7
|
+
constructor(id: string, component: string, reactComponent: React.FunctionComponent<ISplitviewPanelProps>, reactPortalStore: ReactPortalStore);
|
|
8
|
+
getComponent(): ReactPart<ISplitviewPanelProps>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SplitviewApi, SplitviewPanel, } from 'dockview';
|
|
2
|
+
import { ReactPart } from '../react';
|
|
3
|
+
export class ReactPanelView extends SplitviewPanel {
|
|
4
|
+
constructor(id, component, reactComponent, reactPortalStore) {
|
|
5
|
+
super(id, component);
|
|
6
|
+
this.reactComponent = reactComponent;
|
|
7
|
+
this.reactPortalStore = reactPortalStore;
|
|
8
|
+
}
|
|
9
|
+
getComponent() {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
12
|
+
params: (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {},
|
|
13
|
+
api: this.api,
|
|
14
|
+
containerApi: new SplitviewApi(this._params.accessor),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
package/dist/esm/svg.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const CloseButton = () => (React.createElement("svg", { height: "11", width: "11", viewBox: "0 0 28 28", "aria-hidden": 'false', focusable: false, className: "dv-svg" },
|
|
3
|
+
React.createElement("path", { d: "M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z" })));
|
|
4
|
+
export const ExpandMore = () => {
|
|
5
|
+
return (React.createElement("svg", { width: "11", height: "11", viewBox: "0 0 24 15", "aria-hidden": 'false', focusable: false, className: "dv-svg" },
|
|
6
|
+
React.createElement("path", { d: "M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z" })));
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|