dockview 1.4.0 → 1.4.1
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 +1 -1
- package/dist/cjs/api/component.api.d.ts +0 -5
- package/dist/cjs/api/component.api.js +0 -15
- 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/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/dockviewComponent.js +2 -2
- 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/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 +0 -2
- package/dist/cjs/gridview/gridviewComponent.js +2 -6
- 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/types.d.ts +1 -3
- package/dist/cjs/paneview/paneviewComponent.js +2 -2
- package/dist/cjs/paneview/paneviewComponent.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 +0 -1
- package/dist/cjs/splitview/splitviewComponent.js +4 -5
- 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 +34 -155
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.noStyle.js +34 -155
- package/dist/dockview.cjs.js +34 -155
- package/dist/dockview.esm.js +34 -154
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.js +34 -155
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.noStyle.js +34 -155
- package/dist/esm/api/component.api.d.ts +0 -5
- package/dist/esm/api/component.api.js +0 -15
- package/dist/esm/api/panelApi.d.ts +1 -2
- package/dist/esm/api/panelApi.js +3 -3
- 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/dockviewComponent.js +1 -1
- package/dist/esm/dockview/dockviewGroupPanel.js +1 -1
- package/dist/esm/gridview/basePanelView.js +1 -1
- package/dist/esm/gridview/gridviewComponent.d.ts +0 -2
- package/dist/esm/gridview/gridviewComponent.js +2 -6
- package/dist/esm/gridview/gridviewPanel.d.ts +2 -3
- package/dist/esm/gridview/gridviewPanel.js +4 -4
- package/dist/esm/groupview/types.d.ts +1 -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 +0 -1
- package/dist/esm/splitview/splitviewComponent.js +2 -3
- package/dist/esm/splitview/splitviewPanel.js +4 -6
- 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
|
@@ -3,7 +3,6 @@ import { Position } from '../dnd/droptarget';
|
|
|
3
3
|
import { tail, sequenceEquals } from '../array';
|
|
4
4
|
import { CompositeDisposable } from '../lifecycle';
|
|
5
5
|
import { BaseGrid, toTarget, } from './baseComponentGridview';
|
|
6
|
-
import { GridviewApi } from '../api/component.api';
|
|
7
6
|
import { createComponent } from '../panel/componentFactory';
|
|
8
7
|
import { Emitter } from '../events';
|
|
9
8
|
export class GridviewComponent extends BaseGrid {
|
|
@@ -71,9 +70,6 @@ export class GridviewComponent extends BaseGrid {
|
|
|
71
70
|
value.value.setActive(panel === value.value);
|
|
72
71
|
});
|
|
73
72
|
}
|
|
74
|
-
toggleVisibility(panel) {
|
|
75
|
-
this.setVisible(panel, !this.isVisible(panel));
|
|
76
|
-
}
|
|
77
73
|
focus() {
|
|
78
74
|
var _a;
|
|
79
75
|
(_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
|
|
@@ -104,7 +100,7 @@ export class GridviewComponent extends BaseGrid {
|
|
|
104
100
|
maximumHeight: data.maximumHeight,
|
|
105
101
|
priority: data.priority,
|
|
106
102
|
snap: !!data.snap,
|
|
107
|
-
|
|
103
|
+
accessor: this,
|
|
108
104
|
isVisible: node.visible,
|
|
109
105
|
}));
|
|
110
106
|
this.registerPanel(view);
|
|
@@ -170,7 +166,7 @@ export class GridviewComponent extends BaseGrid {
|
|
|
170
166
|
maximumHeight: options.maximumHeight,
|
|
171
167
|
priority: options.priority,
|
|
172
168
|
snap: !!options.snap,
|
|
173
|
-
|
|
169
|
+
accessor: this,
|
|
174
170
|
isVisible: true,
|
|
175
171
|
});
|
|
176
172
|
this.registerPanel(view);
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { PanelInitParameters } from '../panel/types';
|
|
2
|
-
import { IGridPanelComponentView } from './gridviewComponent';
|
|
2
|
+
import { GridviewComponent, IGridPanelComponentView } from './gridviewComponent';
|
|
3
3
|
import { BasePanelView, BasePanelViewExported, BasePanelViewState } from './basePanelView';
|
|
4
4
|
import { GridviewPanelApiImpl } from '../api/gridviewPanelApi';
|
|
5
5
|
import { LayoutPriority } from '../splitview/core/splitview';
|
|
6
6
|
import { Event } from '../events';
|
|
7
7
|
import { IViewSize } from './gridview';
|
|
8
|
-
import { GridviewApi } from '../api/component.api';
|
|
9
8
|
export interface GridviewInitParameters extends PanelInitParameters {
|
|
10
9
|
minimumWidth?: number;
|
|
11
10
|
maximumWidth?: number;
|
|
@@ -13,7 +12,7 @@ export interface GridviewInitParameters extends PanelInitParameters {
|
|
|
13
12
|
maximumHeight?: number;
|
|
14
13
|
priority?: LayoutPriority;
|
|
15
14
|
snap?: boolean;
|
|
16
|
-
|
|
15
|
+
accessor: GridviewComponent;
|
|
17
16
|
isVisible?: boolean;
|
|
18
17
|
}
|
|
19
18
|
export interface IGridviewPanel extends BasePanelViewExported<GridviewPanelApiImpl> {
|
|
@@ -17,11 +17,11 @@ export class GridviewPanel extends BasePanelView {
|
|
|
17
17
|
this.onDidChange = this._onDidChange.event;
|
|
18
18
|
this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
|
|
19
19
|
const { isVisible } = event;
|
|
20
|
-
const {
|
|
21
|
-
|
|
20
|
+
const { accessor } = this._params;
|
|
21
|
+
accessor.setVisible(this, isVisible);
|
|
22
22
|
}), this.api.onActiveChange(() => {
|
|
23
|
-
const {
|
|
24
|
-
|
|
23
|
+
const { accessor } = this._params;
|
|
24
|
+
accessor.setActive(this);
|
|
25
25
|
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
26
26
|
if (typeof event.minimumWidth === 'number' ||
|
|
27
27
|
typeof event.minimumWidth === 'function') {
|
|
@@ -5,7 +5,6 @@ import { PanelInitParameters, IPanel } from '../panel/types';
|
|
|
5
5
|
import { DockviewApi } from '../api/component.api';
|
|
6
6
|
import { GroupPanel } from './groupviewPanel';
|
|
7
7
|
import { Event } from '../events';
|
|
8
|
-
import { WrappedTab } from '../dockview/components/tab/defaultTab';
|
|
9
8
|
export interface IRenderable {
|
|
10
9
|
id: string;
|
|
11
10
|
element: HTMLElement;
|
|
@@ -21,7 +20,7 @@ export interface GroupPanelPartInitParameters extends PanelInitParameters, Heade
|
|
|
21
20
|
containerApi: DockviewApi;
|
|
22
21
|
}
|
|
23
22
|
export interface GroupPanelContentPartInitParameters extends GroupPanelPartInitParameters {
|
|
24
|
-
tab:
|
|
23
|
+
tab: ITabRenderer;
|
|
25
24
|
}
|
|
26
25
|
export interface IWatermarkRenderer extends IPanel {
|
|
27
26
|
readonly element: HTMLElement;
|
|
@@ -43,7 +42,6 @@ export interface IContentRenderer extends IPanel {
|
|
|
43
42
|
readonly onDidBlur?: Event<void>;
|
|
44
43
|
updateParentGroup(group: GroupPanel, isPanelVisible: boolean): void;
|
|
45
44
|
init(parameters: GroupPanelContentPartInitParameters): void;
|
|
46
|
-
close?(): Promise<boolean>;
|
|
47
45
|
}
|
|
48
46
|
export interface WatermarkPartInitParameters {
|
|
49
47
|
accessor: IDockviewComponent;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { IContentRenderer, GroupPanelContentPartInitParameters } from '../../groupview/types';
|
|
2
|
+
import { IContentRenderer, GroupPanelContentPartInitParameters, ITabRenderer } from '../../groupview/types';
|
|
3
3
|
import { ReactPortalStore } from '../react';
|
|
4
4
|
import { IDockviewPanelProps } from '../dockview/dockview';
|
|
5
5
|
import { PanelUpdateEvent } from '../../panel/types';
|
|
@@ -7,7 +7,6 @@ import { DockviewPanelApi } from '../../api/groupPanelApi';
|
|
|
7
7
|
import { DockviewApi } from '../../api/component.api';
|
|
8
8
|
import { GroupPanel } from '../../groupview/groupviewPanel';
|
|
9
9
|
import { Event } from '../../events';
|
|
10
|
-
import { WrappedTab } from '../../dockview/components/tab/defaultTab';
|
|
11
10
|
export interface IGroupPanelActionbarProps {
|
|
12
11
|
api: DockviewPanelApi;
|
|
13
12
|
containerApi: DockviewApi;
|
|
@@ -16,7 +15,7 @@ export interface ReactContentPartContext {
|
|
|
16
15
|
api: DockviewPanelApi;
|
|
17
16
|
containerApi: DockviewApi;
|
|
18
17
|
actionsPortalElement: HTMLElement;
|
|
19
|
-
tabPortalElement:
|
|
18
|
+
tabPortalElement: ITabRenderer;
|
|
20
19
|
}
|
|
21
20
|
export declare class ReactPanelContentPart implements IContentRenderer {
|
|
22
21
|
readonly id: string;
|
|
@@ -42,6 +41,5 @@ export declare class ReactPanelContentPart implements IContentRenderer {
|
|
|
42
41
|
update(event: PanelUpdateEvent): void;
|
|
43
42
|
updateParentGroup(group: GroupPanel, _isPanelVisible: boolean): void;
|
|
44
43
|
layout(_width: number, _height: number): void;
|
|
45
|
-
close(): Promise<boolean>;
|
|
46
44
|
dispose(): void;
|
|
47
45
|
}
|
|
@@ -25,6 +25,5 @@ export declare class ReactContentRenderer implements IContentRenderer {
|
|
|
25
25
|
update(params: PanelUpdateEvent): void;
|
|
26
26
|
updateParentGroup(group: GroupPanel, _isPanelVisible: boolean): void;
|
|
27
27
|
layout(_width: number, _height: number): void;
|
|
28
|
-
close(): Promise<boolean>;
|
|
29
28
|
dispose(): void;
|
|
30
29
|
}
|
|
@@ -62,9 +62,6 @@ export class ReactContentRenderer {
|
|
|
62
62
|
layout(_width, _height) {
|
|
63
63
|
this._hostedContainer.layout(this.element);
|
|
64
64
|
}
|
|
65
|
-
close() {
|
|
66
|
-
return Promise.resolve(true);
|
|
67
|
-
}
|
|
68
65
|
dispose() {
|
|
69
66
|
var _a;
|
|
70
67
|
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GridviewApi } from '../../api/component.api';
|
|
1
2
|
import { GridviewPanel, } from '../../gridview/gridviewPanel';
|
|
2
3
|
import { ReactPart } from '../react';
|
|
3
4
|
export class ReactGridPanelView extends GridviewPanel {
|
|
@@ -11,8 +12,7 @@ export class ReactGridPanelView extends GridviewPanel {
|
|
|
11
12
|
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
12
13
|
params: ((_a = this._params) === null || _a === void 0 ? void 0 : _a.params) || {},
|
|
13
14
|
api: this.api,
|
|
14
|
-
containerApi: this._params
|
|
15
|
-
.containerApi,
|
|
15
|
+
containerApi: new GridviewApi(this._params.accessor),
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
}
|
package/dist/esm/react/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SplitviewApi } from '../../api/component.api';
|
|
1
2
|
import { SplitviewPanel } from '../../splitview/splitviewPanel';
|
|
2
3
|
import { ReactPart } from '../react';
|
|
3
4
|
export class ReactPanelView extends SplitviewPanel {
|
|
@@ -11,8 +12,7 @@ export class ReactPanelView extends SplitviewPanel {
|
|
|
11
12
|
return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {
|
|
12
13
|
params: ((_a = this._params) === null || _a === void 0 ? void 0 : _a.params) || {},
|
|
13
14
|
api: this.api,
|
|
14
|
-
containerApi: this._params
|
|
15
|
-
.containerApi,
|
|
15
|
+
containerApi: new SplitviewApi(this._params.accessor),
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -2,13 +2,13 @@ import { IPanel, PanelInitParameters } from '../../panel/types';
|
|
|
2
2
|
import { IView, SplitViewOptions, LayoutPriority } from './splitview';
|
|
3
3
|
import { FrameworkFactory } from '../../types';
|
|
4
4
|
import { SplitviewPanel } from '../splitviewPanel';
|
|
5
|
-
import {
|
|
5
|
+
import { SplitviewComponent } from '../splitviewComponent';
|
|
6
6
|
export interface PanelViewInitParameters extends PanelInitParameters {
|
|
7
7
|
minimumSize?: number;
|
|
8
8
|
maximumSize?: number;
|
|
9
9
|
snap?: boolean;
|
|
10
10
|
priority?: LayoutPriority;
|
|
11
|
-
|
|
11
|
+
accessor: SplitviewComponent;
|
|
12
12
|
}
|
|
13
13
|
export interface ISerializableView extends IView, IPanel {
|
|
14
14
|
init: (params: PanelViewInitParameters) => void;
|
|
@@ -50,7 +50,6 @@ export interface ISplitviewComponent extends IDisposable {
|
|
|
50
50
|
fromJSON(serializedSplitview: SerializedSplitview): void;
|
|
51
51
|
focus(): void;
|
|
52
52
|
getPanel(id: string): ISplitviewPanel | undefined;
|
|
53
|
-
setActive(view: ISplitviewPanel, skipFocus?: boolean): void;
|
|
54
53
|
removePanel(panel: ISplitviewPanel, sizing?: Sizing): void;
|
|
55
54
|
setVisible(panel: ISplitviewPanel, visible: boolean): void;
|
|
56
55
|
movePanel(from: number, to: number): void;
|
|
@@ -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;
|
|
@@ -212,7 +211,7 @@ export class SplitviewComponent extends CompositeDisposable {
|
|
|
212
211
|
maximumSize: data.maximumSize,
|
|
213
212
|
snap: view.snap,
|
|
214
213
|
priority: view.priority,
|
|
215
|
-
|
|
214
|
+
accessor: this,
|
|
216
215
|
});
|
|
217
216
|
});
|
|
218
217
|
panel.orientation = orientation;
|
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dockview",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
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": "ba2976dd74eeb664dea846690c89ccf8961cdd75"
|
|
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":"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"}
|
|
@@ -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
|
-
};
|