dockview 5.1.0 → 6.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/README.md +3 -1
- package/dist/cjs/dockview/dockview.d.ts +8 -1
- package/dist/cjs/dockview/dockview.js +32 -1
- package/dist/cjs/dockview/headerActionsRenderer.d.ts +1 -0
- package/dist/cjs/dockview/headerActionsRenderer.js +6 -0
- package/dist/cjs/dockview/reactContextMenuItemPart.d.ts +14 -0
- package/dist/cjs/dockview/reactContextMenuItemPart.js +31 -0
- package/dist/cjs/dockview/reactTabGroupChipPart.d.ts +23 -0
- package/dist/cjs/dockview/reactTabGroupChipPart.js +36 -0
- package/dist/cjs/gridview/view.d.ts +0 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/react.js +8 -4
- package/dist/cjs/splitview/view.d.ts +0 -1
- package/dist/dockview.js +95 -7
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.js.map +1 -1
- package/dist/esm/dockview/dockview.d.ts +8 -1
- package/dist/esm/dockview/dockview.js +32 -1
- package/dist/esm/dockview/headerActionsRenderer.d.ts +1 -0
- package/dist/esm/dockview/headerActionsRenderer.js +6 -0
- package/dist/esm/dockview/reactContextMenuItemPart.d.ts +14 -0
- package/dist/esm/dockview/reactContextMenuItemPart.js +22 -0
- package/dist/esm/dockview/reactTabGroupChipPart.d.ts +23 -0
- package/dist/esm/dockview/reactTabGroupChipPart.js +27 -0
- package/dist/esm/gridview/view.d.ts +0 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/react.js +6 -2
- package/dist/esm/splitview/view.d.ts +0 -1
- package/dist/package/main.cjs.js +97 -39
- package/dist/package/main.cjs.min.js +2 -2
- package/dist/package/main.esm.min.mjs +2 -2
- package/dist/package/main.esm.mjs +93 -35
- package/dist/styles/dockview.css +1968 -195
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
##
|
|
18
18
|
|
|
19
|
-

|
|
20
20
|
|
|
21
21
|
Please see the website: https://dockview.dev
|
|
22
22
|
|
|
@@ -28,6 +28,8 @@ Please see the website: https://dockview.dev
|
|
|
28
28
|
- Tab and Group docking / Drag n' Drop
|
|
29
29
|
- Popout Windows
|
|
30
30
|
- Floating Groups
|
|
31
|
+
- Edge Groups
|
|
32
|
+
- Tab Groups
|
|
31
33
|
- Extensive API
|
|
32
34
|
- Supports Shadow DOMs
|
|
33
35
|
- High test coverage
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DockviewWillDropEvent, DockviewDidDropEvent, IWatermarkPanelProps, IDockviewHeaderActionsProps, IDockviewPanelHeaderProps, IDockviewPanelProps, DockviewOptions, DockviewReadyEvent } from 'dockview-core';
|
|
2
|
+
import { DockviewWillDropEvent, DockviewDidDropEvent, IWatermarkPanelProps, IDockviewHeaderActionsProps, IDockviewPanelHeaderProps, IDockviewPanelProps, DockviewOptions, DockviewReadyEvent, BuiltInContextMenuItem, BuiltInChipContextMenuItem, ContextMenuItemConfig, GetTabContextMenuItemsParams, GetTabGroupChipContextMenuItemsParams, IContextMenuItemComponentProps } from 'dockview-core';
|
|
3
|
+
import { IDockviewTabGroupChipProps } from './reactTabGroupChipPart';
|
|
4
|
+
export interface ReactContextMenuItemConfig extends Omit<ContextMenuItemConfig, 'component'> {
|
|
5
|
+
component?: React.FunctionComponent<IContextMenuItemComponentProps>;
|
|
6
|
+
}
|
|
3
7
|
export interface IDockviewReactProps extends DockviewOptions {
|
|
4
8
|
tabComponents?: Record<string, React.FunctionComponent<IDockviewPanelHeaderProps>>;
|
|
5
9
|
components: Record<string, React.FunctionComponent<IDockviewPanelProps>>;
|
|
@@ -8,6 +12,9 @@ export interface IDockviewReactProps extends DockviewOptions {
|
|
|
8
12
|
rightHeaderActionsComponent?: React.FunctionComponent<IDockviewHeaderActionsProps>;
|
|
9
13
|
leftHeaderActionsComponent?: React.FunctionComponent<IDockviewHeaderActionsProps>;
|
|
10
14
|
prefixHeaderActionsComponent?: React.FunctionComponent<IDockviewHeaderActionsProps>;
|
|
15
|
+
getTabContextMenuItems?: (params: GetTabContextMenuItemsParams) => (BuiltInContextMenuItem | ReactContextMenuItemConfig)[];
|
|
16
|
+
getTabGroupChipContextMenuItems?: (params: GetTabGroupChipContextMenuItemsParams) => (BuiltInChipContextMenuItem | ReactContextMenuItemConfig)[];
|
|
17
|
+
tabGroupChipComponent?: React.FunctionComponent<IDockviewTabGroupChipProps>;
|
|
11
18
|
onReady: (event: DockviewReadyEvent) => void;
|
|
12
19
|
onDidDrop?: (event: DockviewDidDropEvent) => void;
|
|
13
20
|
onWillDrop?: (event: DockviewWillDropEvent) => void;
|
|
@@ -38,6 +38,8 @@ var reactHeaderPart_1 = require("./reactHeaderPart");
|
|
|
38
38
|
var react_2 = require("../react");
|
|
39
39
|
var reactWatermarkPart_1 = require("./reactWatermarkPart");
|
|
40
40
|
var headerActionsRenderer_1 = require("./headerActionsRenderer");
|
|
41
|
+
var reactContextMenuItemPart_1 = require("./reactContextMenuItemPart");
|
|
42
|
+
var reactTabGroupChipPart_1 = require("./reactTabGroupChipPart");
|
|
41
43
|
function createGroupControlElement(component, store) {
|
|
42
44
|
return component
|
|
43
45
|
? function (groupPanel) {
|
|
@@ -112,8 +114,23 @@ exports.DockviewReact = react_1.default.forwardRef(function (props, ref) {
|
|
|
112
114
|
defaultTabComponent: props.defaultTabComponent
|
|
113
115
|
? DEFAULT_REACT_TAB
|
|
114
116
|
: undefined,
|
|
117
|
+
createContextMenuItemComponent: function (options) {
|
|
118
|
+
if (!options.component) {
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
return new reactContextMenuItemPart_1.ReactContextMenuItemPart(options.id, options.component, { addPortal: addPortal });
|
|
122
|
+
},
|
|
115
123
|
};
|
|
116
|
-
var
|
|
124
|
+
var coreOptions = extractCoreOptions(props);
|
|
125
|
+
if (props.tabGroupChipComponent) {
|
|
126
|
+
var chipComponent_1 = props.tabGroupChipComponent;
|
|
127
|
+
coreOptions.createTabGroupChipComponent = function () {
|
|
128
|
+
return new reactTabGroupChipPart_1.ReactTabGroupChipPart(chipComponent_1, {
|
|
129
|
+
addPortal: addPortal,
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
var api = (0, dockview_core_1.createDockview)(domRef.current, __assign(__assign({}, coreOptions), frameworkOptions));
|
|
117
134
|
var _b = domRef.current, clientWidth = _b.clientWidth, clientHeight = _b.clientHeight;
|
|
118
135
|
api.layout(clientWidth, clientHeight);
|
|
119
136
|
if (props.onReady) {
|
|
@@ -155,6 +172,20 @@ exports.DockviewReact = react_1.default.forwardRef(function (props, ref) {
|
|
|
155
172
|
disposable.dispose();
|
|
156
173
|
};
|
|
157
174
|
}, [props.onWillDrop]);
|
|
175
|
+
react_1.default.useEffect(function () {
|
|
176
|
+
if (!dockviewRef.current) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
dockviewRef.current.updateOptions({
|
|
180
|
+
createTabGroupChipComponent: props.tabGroupChipComponent
|
|
181
|
+
? function () {
|
|
182
|
+
return new reactTabGroupChipPart_1.ReactTabGroupChipPart(props.tabGroupChipComponent, {
|
|
183
|
+
addPortal: addPortal,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
: undefined,
|
|
187
|
+
});
|
|
188
|
+
}, [props.tabGroupChipComponent]);
|
|
158
189
|
react_1.default.useEffect(function () {
|
|
159
190
|
if (!dockviewRef.current) {
|
|
160
191
|
return;
|
|
@@ -38,6 +38,8 @@ var ReactHeaderActionsRendererPart = /** @class */ (function () {
|
|
|
38
38
|
_this.updateActivePanel();
|
|
39
39
|
}), parameters.api.onDidActiveChange(function () {
|
|
40
40
|
_this.updateGroupActive();
|
|
41
|
+
}), parameters.api.onDidLocationChange(function (event) {
|
|
42
|
+
_this.updateLocation(event.location);
|
|
41
43
|
}));
|
|
42
44
|
this._part = new react_1.ReactPart(this.element, this.reactPortalStore, this.component, {
|
|
43
45
|
api: parameters.api,
|
|
@@ -47,6 +49,7 @@ var ReactHeaderActionsRendererPart = /** @class */ (function () {
|
|
|
47
49
|
isGroupActive: this._group.api.isActive,
|
|
48
50
|
group: this._group,
|
|
49
51
|
headerPosition: this._group.model.headerPosition,
|
|
52
|
+
location: parameters.api.location,
|
|
50
53
|
});
|
|
51
54
|
};
|
|
52
55
|
ReactHeaderActionsRendererPart.prototype.dispose = function () {
|
|
@@ -75,6 +78,9 @@ var ReactHeaderActionsRendererPart = /** @class */ (function () {
|
|
|
75
78
|
},
|
|
76
79
|
});
|
|
77
80
|
};
|
|
81
|
+
ReactHeaderActionsRendererPart.prototype.updateLocation = function (location) {
|
|
82
|
+
this.update({ params: { location: location } });
|
|
83
|
+
};
|
|
78
84
|
return ReactHeaderActionsRendererPart;
|
|
79
85
|
}());
|
|
80
86
|
exports.ReactHeaderActionsRendererPart = ReactHeaderActionsRendererPart;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ReactPortalStore } from '../react';
|
|
3
|
+
import { IContextMenuItemRenderer, IContextMenuItemComponentProps } from 'dockview-core';
|
|
4
|
+
export declare class ReactContextMenuItemPart implements IContextMenuItemRenderer {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
private readonly component;
|
|
7
|
+
private readonly reactPortalStore;
|
|
8
|
+
private readonly _element;
|
|
9
|
+
private part?;
|
|
10
|
+
get element(): HTMLElement;
|
|
11
|
+
constructor(id: string, component: React.FunctionComponent<IContextMenuItemComponentProps>, reactPortalStore: ReactPortalStore);
|
|
12
|
+
init(props: IContextMenuItemComponentProps): void;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReactContextMenuItemPart = void 0;
|
|
4
|
+
var react_1 = require("../react");
|
|
5
|
+
var ReactContextMenuItemPart = /** @class */ (function () {
|
|
6
|
+
function ReactContextMenuItemPart(id, component, reactPortalStore) {
|
|
7
|
+
this.id = id;
|
|
8
|
+
this.component = component;
|
|
9
|
+
this.reactPortalStore = reactPortalStore;
|
|
10
|
+
this._element = document.createElement('div');
|
|
11
|
+
this._element.className = 'dv-react-part';
|
|
12
|
+
this._element.style.height = '100%';
|
|
13
|
+
this._element.style.width = '100%';
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(ReactContextMenuItemPart.prototype, "element", {
|
|
16
|
+
get: function () {
|
|
17
|
+
return this._element;
|
|
18
|
+
},
|
|
19
|
+
enumerable: false,
|
|
20
|
+
configurable: true
|
|
21
|
+
});
|
|
22
|
+
ReactContextMenuItemPart.prototype.init = function (props) {
|
|
23
|
+
this.part = new react_1.ReactPart(this._element, this.reactPortalStore, this.component, props);
|
|
24
|
+
};
|
|
25
|
+
ReactContextMenuItemPart.prototype.dispose = function () {
|
|
26
|
+
var _a;
|
|
27
|
+
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
28
|
+
};
|
|
29
|
+
return ReactContextMenuItemPart;
|
|
30
|
+
}());
|
|
31
|
+
exports.ReactContextMenuItemPart = ReactContextMenuItemPart;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ReactPortalStore } from '../react';
|
|
3
|
+
import { ITabGroupChipRenderer, ITabGroup, DockviewApi } from 'dockview-core';
|
|
4
|
+
export interface IDockviewTabGroupChipProps {
|
|
5
|
+
tabGroup: ITabGroup;
|
|
6
|
+
api: DockviewApi;
|
|
7
|
+
}
|
|
8
|
+
export declare class ReactTabGroupChipPart implements ITabGroupChipRenderer {
|
|
9
|
+
private readonly component;
|
|
10
|
+
private readonly reactPortalStore;
|
|
11
|
+
private readonly _element;
|
|
12
|
+
private part?;
|
|
13
|
+
get element(): HTMLElement;
|
|
14
|
+
constructor(component: React.FunctionComponent<IDockviewTabGroupChipProps>, reactPortalStore: ReactPortalStore);
|
|
15
|
+
init(params: {
|
|
16
|
+
tabGroup: ITabGroup;
|
|
17
|
+
api: DockviewApi;
|
|
18
|
+
}): void;
|
|
19
|
+
update(params: {
|
|
20
|
+
tabGroup: ITabGroup;
|
|
21
|
+
}): void;
|
|
22
|
+
dispose(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReactTabGroupChipPart = void 0;
|
|
4
|
+
var react_1 = require("../react");
|
|
5
|
+
var ReactTabGroupChipPart = /** @class */ (function () {
|
|
6
|
+
function ReactTabGroupChipPart(component, reactPortalStore) {
|
|
7
|
+
this.component = component;
|
|
8
|
+
this.reactPortalStore = reactPortalStore;
|
|
9
|
+
this._element = document.createElement('div');
|
|
10
|
+
this._element.className = 'dv-react-part';
|
|
11
|
+
this._element.style.display = 'inline-flex';
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(ReactTabGroupChipPart.prototype, "element", {
|
|
14
|
+
get: function () {
|
|
15
|
+
return this._element;
|
|
16
|
+
},
|
|
17
|
+
enumerable: false,
|
|
18
|
+
configurable: true
|
|
19
|
+
});
|
|
20
|
+
ReactTabGroupChipPart.prototype.init = function (params) {
|
|
21
|
+
this.part = new react_1.ReactPart(this._element, this.reactPortalStore, this.component, {
|
|
22
|
+
tabGroup: params.tabGroup,
|
|
23
|
+
api: params.api,
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
ReactTabGroupChipPart.prototype.update = function (params) {
|
|
27
|
+
var _a;
|
|
28
|
+
(_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ tabGroup: params.tabGroup });
|
|
29
|
+
};
|
|
30
|
+
ReactTabGroupChipPart.prototype.dispose = function () {
|
|
31
|
+
var _a;
|
|
32
|
+
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
33
|
+
};
|
|
34
|
+
return ReactTabGroupChipPart;
|
|
35
|
+
}());
|
|
36
|
+
exports.ReactTabGroupChipPart = ReactTabGroupChipPart;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from 'dockview-core';
|
|
2
2
|
export * from './dockview/dockview';
|
|
3
3
|
export * from './dockview/defaultTab';
|
|
4
|
+
export { IDockviewTabGroupChipProps } from './dockview/reactTabGroupChipPart';
|
|
4
5
|
export * from './splitview/splitview';
|
|
5
6
|
export * from './gridview/gridview';
|
|
6
7
|
export * from './paneview/paneview';
|
package/dist/cjs/react.js
CHANGED
|
@@ -39,7 +39,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.
|
|
42
|
+
exports.usePortalsLifecycle = exports.ReactPart = exports.ReactPartContext = void 0;
|
|
43
|
+
exports.isReactComponent = isReactComponent;
|
|
43
44
|
var react_1 = __importDefault(require("react"));
|
|
44
45
|
var react_dom_1 = __importDefault(require("react-dom"));
|
|
45
46
|
var dockview_core_1 = require("dockview-core");
|
|
@@ -52,7 +53,7 @@ var dockview_core_1 = require("dockview-core");
|
|
|
52
53
|
* component
|
|
53
54
|
*/
|
|
54
55
|
var ReactComponentBridge = function (props, ref) {
|
|
55
|
-
var _a = __read(react_1.default.useState(), 2),
|
|
56
|
+
var _a = __read(react_1.default.useState(0), 2), triggerRender = _a[1];
|
|
56
57
|
var _props = react_1.default.useRef(props.componentProps);
|
|
57
58
|
react_1.default.useImperativeHandle(ref, function () { return ({
|
|
58
59
|
update: function (componentProps) {
|
|
@@ -62,8 +63,12 @@ var ReactComponentBridge = function (props, ref) {
|
|
|
62
63
|
* trigger a re-render.
|
|
63
64
|
* we use this rather than updating through a prop since we can
|
|
64
65
|
* pass a ref into the vanilla-js world.
|
|
66
|
+
*
|
|
67
|
+
* Use a monotonic counter rather than `Date.now()` so two
|
|
68
|
+
* updates within the same millisecond still produce distinct
|
|
69
|
+
* state values and avoid React's bailout.
|
|
65
70
|
*/
|
|
66
|
-
triggerRender(
|
|
71
|
+
triggerRender(function (n) { return n + 1; });
|
|
67
72
|
},
|
|
68
73
|
}); }, []);
|
|
69
74
|
return react_1.default.createElement(props.component, _props.current);
|
|
@@ -176,4 +181,3 @@ function isReactComponent(component) {
|
|
|
176
181
|
return (typeof component === 'function' /** Functional Componnts */ ||
|
|
177
182
|
!!(component === null || component === void 0 ? void 0 : component.$$typeof) /** React.memo(...) Components */);
|
|
178
183
|
}
|
|
179
|
-
exports.isReactComponent = isReactComponent;
|