dockview 6.2.1 → 6.3.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/dist/cjs/dockview/dockview.d.ts +11 -0
- package/dist/cjs/dockview/dockview.js +23 -0
- package/dist/cjs/dockview/reactGroupDragGhostPart.d.ts +20 -0
- package/dist/cjs/dockview/reactGroupDragGhostPart.js +32 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/dockview.js +46 -1
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.js.map +1 -1
- package/dist/esm/dockview/dockview.d.ts +11 -0
- package/dist/esm/dockview/dockview.js +23 -0
- package/dist/esm/dockview/reactGroupDragGhostPart.d.ts +20 -0
- package/dist/esm/dockview/reactGroupDragGhostPart.js +23 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/package/main.cjs.js +46 -1
- package/dist/package/main.cjs.min.js +2 -2
- package/dist/package/main.esm.min.mjs +2 -2
- package/dist/package/main.esm.mjs +46 -1
- package/package.json +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DockviewWillDropEvent, DockviewDidDropEvent, IWatermarkPanelProps, IDockviewHeaderActionsProps, IDockviewPanelHeaderProps, IDockviewPanelProps, DockviewOptions, DockviewReadyEvent, BuiltInContextMenuItem, BuiltInChipContextMenuItem, ContextMenuItemConfig, GetTabContextMenuItemsParams, GetTabGroupChipContextMenuItemsParams, IContextMenuItemComponentProps } from 'dockview-core';
|
|
3
3
|
import { IDockviewTabGroupChipProps } from './reactTabGroupChipPart';
|
|
4
|
+
import { IDockviewGroupDragGhostProps } from './reactGroupDragGhostPart';
|
|
4
5
|
export interface ReactContextMenuItemConfig extends Omit<ContextMenuItemConfig, 'component'> {
|
|
5
6
|
component?: React.FunctionComponent<IContextMenuItemComponentProps>;
|
|
6
7
|
}
|
|
@@ -15,6 +16,16 @@ export interface IDockviewReactProps extends DockviewOptions {
|
|
|
15
16
|
getTabContextMenuItems?: (params: GetTabContextMenuItemsParams) => (BuiltInContextMenuItem | ReactContextMenuItemConfig)[];
|
|
16
17
|
getTabGroupChipContextMenuItems?: (params: GetTabGroupChipContextMenuItemsParams) => (BuiltInChipContextMenuItem | ReactContextMenuItemConfig)[];
|
|
17
18
|
tabGroupChipComponent?: React.FunctionComponent<IDockviewTabGroupChipProps>;
|
|
19
|
+
/**
|
|
20
|
+
* Component rendered as the drag ghost (the small floating chip) while
|
|
21
|
+
* a group of panels is being dragged. If omitted, the default
|
|
22
|
+
* `"Multiple Panels (N)"` ghost is used.
|
|
23
|
+
*
|
|
24
|
+
* Note: the ghost is captured by the browser at drag start, so the
|
|
25
|
+
* component must render fast / synchronously enough to be visible
|
|
26
|
+
* before the browser snapshots it.
|
|
27
|
+
*/
|
|
28
|
+
groupDragGhostComponent?: React.FunctionComponent<IDockviewGroupDragGhostProps>;
|
|
18
29
|
onReady: (event: DockviewReadyEvent) => void;
|
|
19
30
|
onDidDrop?: (event: DockviewDidDropEvent) => void;
|
|
20
31
|
onWillDrop?: (event: DockviewWillDropEvent) => void;
|
|
@@ -40,6 +40,7 @@ var reactWatermarkPart_1 = require("./reactWatermarkPart");
|
|
|
40
40
|
var headerActionsRenderer_1 = require("./headerActionsRenderer");
|
|
41
41
|
var reactContextMenuItemPart_1 = require("./reactContextMenuItemPart");
|
|
42
42
|
var reactTabGroupChipPart_1 = require("./reactTabGroupChipPart");
|
|
43
|
+
var reactGroupDragGhostPart_1 = require("./reactGroupDragGhostPart");
|
|
43
44
|
function createGroupControlElement(component, store) {
|
|
44
45
|
return component
|
|
45
46
|
? function (groupPanel) {
|
|
@@ -130,6 +131,14 @@ exports.DockviewReact = react_1.default.forwardRef(function (props, ref) {
|
|
|
130
131
|
});
|
|
131
132
|
};
|
|
132
133
|
}
|
|
134
|
+
if (props.groupDragGhostComponent) {
|
|
135
|
+
var ghostComponent_1 = props.groupDragGhostComponent;
|
|
136
|
+
coreOptions.createGroupDragGhostComponent = function () {
|
|
137
|
+
return new reactGroupDragGhostPart_1.ReactGroupDragGhostPart(ghostComponent_1, {
|
|
138
|
+
addPortal: addPortal,
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
}
|
|
133
142
|
var api = (0, dockview_core_1.createDockview)(domRef.current, __assign(__assign({}, coreOptions), frameworkOptions));
|
|
134
143
|
var _b = domRef.current, clientWidth = _b.clientWidth, clientHeight = _b.clientHeight;
|
|
135
144
|
api.layout(clientWidth, clientHeight);
|
|
@@ -186,6 +195,20 @@ exports.DockviewReact = react_1.default.forwardRef(function (props, ref) {
|
|
|
186
195
|
: undefined,
|
|
187
196
|
});
|
|
188
197
|
}, [props.tabGroupChipComponent]);
|
|
198
|
+
react_1.default.useEffect(function () {
|
|
199
|
+
if (!dockviewRef.current) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
dockviewRef.current.updateOptions({
|
|
203
|
+
createGroupDragGhostComponent: props.groupDragGhostComponent
|
|
204
|
+
? function () {
|
|
205
|
+
return new reactGroupDragGhostPart_1.ReactGroupDragGhostPart(props.groupDragGhostComponent, {
|
|
206
|
+
addPortal: addPortal,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
: undefined,
|
|
210
|
+
});
|
|
211
|
+
}, [props.groupDragGhostComponent]);
|
|
189
212
|
react_1.default.useEffect(function () {
|
|
190
213
|
if (!dockviewRef.current) {
|
|
191
214
|
return;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ReactPortalStore } from '../react';
|
|
3
|
+
import { IDockviewGroupPanel, IGroupDragGhostRenderer, DockviewApi } from 'dockview-core';
|
|
4
|
+
export interface IDockviewGroupDragGhostProps {
|
|
5
|
+
group: IDockviewGroupPanel;
|
|
6
|
+
api: DockviewApi;
|
|
7
|
+
}
|
|
8
|
+
export declare class ReactGroupDragGhostPart implements IGroupDragGhostRenderer {
|
|
9
|
+
private readonly component;
|
|
10
|
+
private readonly reactPortalStore;
|
|
11
|
+
private readonly _element;
|
|
12
|
+
private part?;
|
|
13
|
+
get element(): HTMLElement;
|
|
14
|
+
constructor(component: React.FunctionComponent<IDockviewGroupDragGhostProps>, reactPortalStore: ReactPortalStore);
|
|
15
|
+
init(params: {
|
|
16
|
+
group: IDockviewGroupPanel;
|
|
17
|
+
api: DockviewApi;
|
|
18
|
+
}): void;
|
|
19
|
+
dispose(): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReactGroupDragGhostPart = void 0;
|
|
4
|
+
var react_1 = require("../react");
|
|
5
|
+
var ReactGroupDragGhostPart = /** @class */ (function () {
|
|
6
|
+
function ReactGroupDragGhostPart(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(ReactGroupDragGhostPart.prototype, "element", {
|
|
14
|
+
get: function () {
|
|
15
|
+
return this._element;
|
|
16
|
+
},
|
|
17
|
+
enumerable: false,
|
|
18
|
+
configurable: true
|
|
19
|
+
});
|
|
20
|
+
ReactGroupDragGhostPart.prototype.init = function (params) {
|
|
21
|
+
this.part = new react_1.ReactPart(this._element, this.reactPortalStore, this.component, {
|
|
22
|
+
group: params.group,
|
|
23
|
+
api: params.api,
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
ReactGroupDragGhostPart.prototype.dispose = function () {
|
|
27
|
+
var _a;
|
|
28
|
+
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
29
|
+
};
|
|
30
|
+
return ReactGroupDragGhostPart;
|
|
31
|
+
}());
|
|
32
|
+
exports.ReactGroupDragGhostPart = ReactGroupDragGhostPart;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from 'dockview-core';
|
|
|
2
2
|
export * from './dockview/dockview';
|
|
3
3
|
export * from './dockview/defaultTab';
|
|
4
4
|
export { IDockviewTabGroupChipProps } from './dockview/reactTabGroupChipPart';
|
|
5
|
+
export { IDockviewGroupDragGhostProps } from './dockview/reactGroupDragGhostPart';
|
|
5
6
|
export * from './splitview/splitview';
|
|
6
7
|
export * from './gridview/gridview';
|
|
7
8
|
export * from './paneview/paneview';
|
package/dist/dockview.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 6.
|
|
3
|
+
* @version 6.3.0
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -409,6 +409,29 @@
|
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
|
|
412
|
+
class ReactGroupDragGhostPart {
|
|
413
|
+
get element() {
|
|
414
|
+
return this._element;
|
|
415
|
+
}
|
|
416
|
+
constructor(component, reactPortalStore) {
|
|
417
|
+
this.component = component;
|
|
418
|
+
this.reactPortalStore = reactPortalStore;
|
|
419
|
+
this._element = document.createElement('div');
|
|
420
|
+
this._element.className = 'dv-react-part';
|
|
421
|
+
this._element.style.display = 'inline-flex';
|
|
422
|
+
}
|
|
423
|
+
init(params) {
|
|
424
|
+
this.part = new ReactPart(this._element, this.reactPortalStore, this.component, {
|
|
425
|
+
group: params.group,
|
|
426
|
+
api: params.api,
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
dispose() {
|
|
430
|
+
var _a;
|
|
431
|
+
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
412
435
|
function createGroupControlElement(component, store) {
|
|
413
436
|
return component
|
|
414
437
|
? (groupPanel) => {
|
|
@@ -496,6 +519,14 @@
|
|
|
496
519
|
});
|
|
497
520
|
};
|
|
498
521
|
}
|
|
522
|
+
if (props.groupDragGhostComponent) {
|
|
523
|
+
const ghostComponent = props.groupDragGhostComponent;
|
|
524
|
+
coreOptions.createGroupDragGhostComponent = () => {
|
|
525
|
+
return new ReactGroupDragGhostPart(ghostComponent, {
|
|
526
|
+
addPortal,
|
|
527
|
+
});
|
|
528
|
+
};
|
|
529
|
+
}
|
|
499
530
|
const api = dockviewCore.createDockview(domRef.current, Object.assign(Object.assign({}, coreOptions), frameworkOptions));
|
|
500
531
|
const { clientWidth, clientHeight } = domRef.current;
|
|
501
532
|
api.layout(clientWidth, clientHeight);
|
|
@@ -552,6 +583,20 @@
|
|
|
552
583
|
: undefined,
|
|
553
584
|
});
|
|
554
585
|
}, [props.tabGroupChipComponent]);
|
|
586
|
+
React.useEffect(() => {
|
|
587
|
+
if (!dockviewRef.current) {
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
dockviewRef.current.updateOptions({
|
|
591
|
+
createGroupDragGhostComponent: props.groupDragGhostComponent
|
|
592
|
+
? () => {
|
|
593
|
+
return new ReactGroupDragGhostPart(props.groupDragGhostComponent, {
|
|
594
|
+
addPortal,
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
: undefined,
|
|
598
|
+
});
|
|
599
|
+
}, [props.groupDragGhostComponent]);
|
|
555
600
|
React.useEffect(() => {
|
|
556
601
|
if (!dockviewRef.current) {
|
|
557
602
|
return;
|