dockview 6.2.2 → 6.4.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 CHANGED
@@ -26,6 +26,7 @@ Please see the website: https://dockview.dev
26
26
  - Support for split-views, grid-views and 'dockable' views
27
27
  - Themeable and customizable
28
28
  - Tab and Group docking / Drag n' Drop
29
+ - Touch & mobile support
29
30
  - Popout Windows
30
31
  - Floating Groups
31
32
  - Edge Groups
@@ -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;
@@ -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';