dockview-core 1.16.1 → 1.17.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/dist/cjs/dnd/groupDragHandler.js +1 -1
- package/dist/cjs/dockview/components/tab/defaultTab.js +2 -2
- package/dist/cjs/dockview/components/tab/tab.js +1 -1
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +2 -2
- package/dist/cjs/dockview/components/watermark/watermark.d.ts +0 -7
- package/dist/cjs/dockview/components/watermark/watermark.js +3 -18
- package/dist/cjs/dockview/deserializer.js +4 -0
- package/dist/cjs/dockview/dockviewComponent.d.ts +2 -0
- package/dist/cjs/dockview/dockviewComponent.js +76 -58
- package/dist/cjs/dockview/dockviewGroupPanel.d.ts +4 -0
- package/dist/cjs/dockview/dockviewGroupPanel.js +49 -2
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +4 -0
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +0 -1
- package/dist/cjs/dockview/dockviewPanel.d.ts +14 -1
- package/dist/cjs/dockview/dockviewPanel.js +36 -0
- package/dist/cjs/dockview/options.d.ts +16 -9
- package/dist/cjs/dockview/types.d.ts +5 -2
- package/dist/cjs/dom.d.ts +7 -0
- package/dist/cjs/dom.js +63 -1
- package/dist/cjs/gridview/baseComponentGridview.d.ts +2 -3
- package/dist/cjs/gridview/baseComponentGridview.js +28 -51
- package/dist/cjs/gridview/gridviewComponent.js +1 -2
- package/dist/cjs/gridview/gridviewPanel.d.ts +6 -0
- package/dist/cjs/overlay/overlay.js +8 -8
- package/dist/cjs/paneview/paneviewComponent.d.ts +1 -1
- package/dist/cjs/paneview/paneviewComponent.js +25 -63
- package/dist/cjs/splitview/splitviewComponent.d.ts +1 -1
- package/dist/cjs/splitview/splitviewComponent.js +29 -69
- package/dist/dockview-core.amd.js +221 -136
- package/dist/dockview-core.amd.js.map +1 -1
- package/dist/dockview-core.amd.min.js +2 -2
- package/dist/dockview-core.amd.min.js.map +1 -1
- package/dist/dockview-core.amd.min.noStyle.js +2 -2
- package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
- package/dist/dockview-core.amd.noStyle.js +220 -135
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +221 -136
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +221 -136
- package/dist/dockview-core.esm.js.map +1 -1
- package/dist/dockview-core.esm.min.js +2 -2
- package/dist/dockview-core.esm.min.js.map +1 -1
- package/dist/dockview-core.js +221 -136
- package/dist/dockview-core.js.map +1 -1
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.js.map +1 -1
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.min.noStyle.js.map +1 -1
- package/dist/dockview-core.noStyle.js +220 -135
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/dnd/groupDragHandler.js +1 -1
- package/dist/esm/dockview/components/tab/defaultTab.js +2 -2
- package/dist/esm/dockview/components/tab/tab.js +1 -1
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +2 -2
- package/dist/esm/dockview/components/watermark/watermark.d.ts +0 -7
- package/dist/esm/dockview/components/watermark/watermark.js +3 -18
- package/dist/esm/dockview/deserializer.js +4 -0
- package/dist/esm/dockview/dockviewComponent.d.ts +2 -0
- package/dist/esm/dockview/dockviewComponent.js +75 -54
- package/dist/esm/dockview/dockviewGroupPanel.d.ts +4 -0
- package/dist/esm/dockview/dockviewGroupPanel.js +33 -2
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +4 -0
- package/dist/esm/dockview/dockviewGroupPanelModel.js +0 -1
- package/dist/esm/dockview/dockviewPanel.d.ts +14 -1
- package/dist/esm/dockview/dockviewPanel.js +20 -0
- package/dist/esm/dockview/options.d.ts +16 -9
- package/dist/esm/dockview/types.d.ts +5 -2
- package/dist/esm/dom.d.ts +7 -0
- package/dist/esm/dom.js +36 -0
- package/dist/esm/gridview/baseComponentGridview.d.ts +2 -3
- package/dist/esm/gridview/baseComponentGridview.js +26 -17
- package/dist/esm/gridview/gridviewComponent.js +1 -2
- package/dist/esm/gridview/gridviewPanel.d.ts +6 -0
- package/dist/esm/overlay/overlay.js +8 -8
- package/dist/esm/paneview/paneviewComponent.d.ts +1 -1
- package/dist/esm/paneview/paneviewComponent.js +8 -14
- package/dist/esm/splitview/splitviewComponent.d.ts +1 -1
- package/dist/esm/splitview/splitviewComponent.js +10 -18
- package/dist/styles/dockview.css +1 -1
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ export class GroupDragHandler extends DragHandler {
|
|
|
9
9
|
this.accessor = accessor;
|
|
10
10
|
this.group = group;
|
|
11
11
|
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
12
|
-
this.addDisposables(addDisposableListener(element, '
|
|
12
|
+
this.addDisposables(addDisposableListener(element, 'pointerdown', (e) => {
|
|
13
13
|
if (e.shiftKey) {
|
|
14
14
|
/**
|
|
15
15
|
* You cannot call e.preventDefault() because that will prevent drag events from firing
|
|
@@ -16,7 +16,7 @@ export class DefaultTab extends CompositeDisposable {
|
|
|
16
16
|
this.action.appendChild(createCloseButton());
|
|
17
17
|
this._element.appendChild(this._content);
|
|
18
18
|
this._element.appendChild(this.action);
|
|
19
|
-
this.addDisposables(addDisposableListener(this.action, '
|
|
19
|
+
this.addDisposables(addDisposableListener(this.action, 'pointerdown', (ev) => {
|
|
20
20
|
ev.preventDefault();
|
|
21
21
|
}));
|
|
22
22
|
this.render();
|
|
@@ -26,7 +26,7 @@ export class DefaultTab extends CompositeDisposable {
|
|
|
26
26
|
this.addDisposables(params.api.onDidTitleChange((event) => {
|
|
27
27
|
this._title = event.title;
|
|
28
28
|
this.render();
|
|
29
|
-
}), addDisposableListener(this.action, '
|
|
29
|
+
}), addDisposableListener(this.action, 'pointerdown', (ev) => {
|
|
30
30
|
ev.preventDefault();
|
|
31
31
|
}), addDisposableListener(this.action, 'click', (ev) => {
|
|
32
32
|
if (ev.defaultPrevented) {
|
|
@@ -64,7 +64,7 @@ export class Tab extends CompositeDisposable {
|
|
|
64
64
|
this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
|
|
65
65
|
this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
|
|
66
66
|
this._onDragStart.fire(event);
|
|
67
|
-
}), dragHandler, addDisposableListener(this._element, '
|
|
67
|
+
}), dragHandler, addDisposableListener(this._element, 'pointerdown', (event) => {
|
|
68
68
|
if (event.defaultPrevented) {
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
@@ -134,7 +134,7 @@ export class TabsContainer extends CompositeDisposable {
|
|
|
134
134
|
group: this.group,
|
|
135
135
|
getData: getPanelData,
|
|
136
136
|
}));
|
|
137
|
-
}), addDisposableListener(this.voidContainer.element, '
|
|
137
|
+
}), addDisposableListener(this.voidContainer.element, 'pointerdown', (event) => {
|
|
138
138
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
139
139
|
if (isFloatingGroupsEnabled &&
|
|
140
140
|
event.shiftKey &&
|
|
@@ -148,7 +148,7 @@ export class TabsContainer extends CompositeDisposable {
|
|
|
148
148
|
inDragMode: true,
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
-
}), addDisposableListener(this.tabContainer, '
|
|
151
|
+
}), addDisposableListener(this.tabContainer, 'pointerdown', (event) => {
|
|
152
152
|
if (event.defaultPrevented) {
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import { IWatermarkRenderer, WatermarkRendererInitParameters } from '../../types';
|
|
2
2
|
import { CompositeDisposable } from '../../../lifecycle';
|
|
3
|
-
import { DockviewGroupPanel } from '../../dockviewGroupPanel';
|
|
4
|
-
import { PanelUpdateEvent } from '../../../panel/types';
|
|
5
3
|
export declare class Watermark extends CompositeDisposable implements IWatermarkRenderer {
|
|
6
4
|
private _element;
|
|
7
5
|
private _group;
|
|
8
6
|
private _api;
|
|
9
7
|
get element(): HTMLElement;
|
|
10
8
|
constructor();
|
|
11
|
-
update(_event: PanelUpdateEvent): void;
|
|
12
|
-
focus(): void;
|
|
13
|
-
layout(_width: number, _height: number): void;
|
|
14
9
|
init(_params: WatermarkRendererInitParameters): void;
|
|
15
|
-
updateParentGroup(group: DockviewGroupPanel, _visible: boolean): void;
|
|
16
|
-
dispose(): void;
|
|
17
10
|
private render;
|
|
18
11
|
}
|
|
@@ -26,34 +26,19 @@ export class Watermark extends CompositeDisposable {
|
|
|
26
26
|
actionsContainer.appendChild(closeAnchor);
|
|
27
27
|
title.appendChild(emptySpace);
|
|
28
28
|
title.appendChild(actionsContainer);
|
|
29
|
-
this.addDisposables(addDisposableListener(closeAnchor, 'click', (
|
|
29
|
+
this.addDisposables(addDisposableListener(closeAnchor, 'click', (event) => {
|
|
30
30
|
var _a;
|
|
31
|
-
|
|
31
|
+
event.preventDefault();
|
|
32
32
|
if (this._group) {
|
|
33
33
|
(_a = this._api) === null || _a === void 0 ? void 0 : _a.removeGroup(this._group);
|
|
34
34
|
}
|
|
35
35
|
}));
|
|
36
36
|
}
|
|
37
|
-
update(_event) {
|
|
38
|
-
// noop
|
|
39
|
-
}
|
|
40
|
-
focus() {
|
|
41
|
-
// noop
|
|
42
|
-
}
|
|
43
|
-
layout(_width, _height) {
|
|
44
|
-
// noop
|
|
45
|
-
}
|
|
46
37
|
init(_params) {
|
|
47
38
|
this._api = _params.containerApi;
|
|
39
|
+
this._group = _params.group;
|
|
48
40
|
this.render();
|
|
49
41
|
}
|
|
50
|
-
updateParentGroup(group, _visible) {
|
|
51
|
-
this._group = group;
|
|
52
|
-
this.render();
|
|
53
|
-
}
|
|
54
|
-
dispose() {
|
|
55
|
-
super.dispose();
|
|
56
|
-
}
|
|
57
42
|
render() {
|
|
58
43
|
const isOneGroup = !!(this._api && this._api.size <= 1);
|
|
59
44
|
toggleClass(this.element, 'has-actions', isOneGroup);
|
|
@@ -20,6 +20,10 @@ export class DefaultDockviewDeserialzier {
|
|
|
20
20
|
const view = new DockviewPanelModel(this.accessor, panelId, contentComponent, tabComponent);
|
|
21
21
|
const panel = new DockviewPanel(panelId, contentComponent, tabComponent, this.accessor, new DockviewApi(this.accessor), group, view, {
|
|
22
22
|
renderer: panelData.renderer,
|
|
23
|
+
minimumWidth: panelData.minimumWidth,
|
|
24
|
+
minimumHeight: panelData.minimumHeight,
|
|
25
|
+
maximumWidth: panelData.maximumWidth,
|
|
26
|
+
maximumHeight: panelData.maximumHeight,
|
|
23
27
|
});
|
|
24
28
|
panel.init({
|
|
25
29
|
title: title !== null && title !== void 0 ? title : panelId,
|
|
@@ -220,6 +220,7 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
|
|
|
220
220
|
createWatermarkComponent(): IWatermarkRenderer;
|
|
221
221
|
private updateWatermark;
|
|
222
222
|
addGroup(options?: AddGroupOptions): DockviewGroupPanel;
|
|
223
|
+
private getLocationOrientation;
|
|
223
224
|
removeGroup(group: DockviewGroupPanel, options?: {
|
|
224
225
|
skipActive?: boolean;
|
|
225
226
|
skipDispose?: boolean;
|
|
@@ -243,5 +244,6 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
|
|
|
243
244
|
private createPanel;
|
|
244
245
|
private createGroupAtLocation;
|
|
245
246
|
private findGroup;
|
|
247
|
+
private orientationAtLocation;
|
|
246
248
|
}
|
|
247
249
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getRelativeLocation, getGridLocation, } from '../gridview/gridview';
|
|
1
|
+
import { getRelativeLocation, getGridLocation, orthogonal, } from '../gridview/gridview';
|
|
2
2
|
import { directionToPosition, Droptarget, } from '../dnd/droptarget';
|
|
3
3
|
import { tail, sequenceEquals, remove } from '../array';
|
|
4
4
|
import { DockviewPanel } from './dockviewPanel';
|
|
@@ -10,13 +10,13 @@ import { DefaultDockviewDeserialzier } from './deserializer';
|
|
|
10
10
|
import { DockviewUnhandledDragOverEvent, isGroupOptionsWithGroup, isGroupOptionsWithPanel, isPanelOptionsWithGroup, isPanelOptionsWithPanel, } from './options';
|
|
11
11
|
import { BaseGrid, toTarget, } from '../gridview/baseComponentGridview';
|
|
12
12
|
import { DockviewApi } from '../api/component.api';
|
|
13
|
-
import { Orientation
|
|
13
|
+
import { Orientation } from '../splitview/splitview';
|
|
14
14
|
import { DockviewDidDropEvent, DockviewWillDropEvent, WillShowOverlayLocationEvent, } from './dockviewGroupPanelModel';
|
|
15
15
|
import { DockviewGroupPanel } from './dockviewGroupPanel';
|
|
16
16
|
import { DockviewPanelModel } from './dockviewPanelModel';
|
|
17
17
|
import { getPanelData } from '../dnd/dataTransfer';
|
|
18
18
|
import { Overlay } from '../overlay/overlay';
|
|
19
|
-
import { addTestId, toggleClass, watchElementResize } from '../dom';
|
|
19
|
+
import { addTestId, getDockviewTheme, toggleClass, watchElementResize, } from '../dom';
|
|
20
20
|
import { DockviewFloatingGroupPanel } from './dockviewFloatingGroupPanel';
|
|
21
21
|
import { DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE, DEFAULT_FLOATING_GROUP_POSITION, } from '../constants';
|
|
22
22
|
import { OverlayRenderContainer, } from '../overlay/overlayRenderContainer';
|
|
@@ -39,25 +39,6 @@ function moveGroupWithoutDestroying(options) {
|
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
function getDockviewTheme(element) {
|
|
43
|
-
function toClassList(element) {
|
|
44
|
-
const list = [];
|
|
45
|
-
for (let i = 0; i < element.classList.length; i++) {
|
|
46
|
-
list.push(element.classList.item(i));
|
|
47
|
-
}
|
|
48
|
-
return list;
|
|
49
|
-
}
|
|
50
|
-
let theme = undefined;
|
|
51
|
-
let parent = element;
|
|
52
|
-
while (parent !== null) {
|
|
53
|
-
theme = toClassList(parent).find((cls) => cls.startsWith('dockview-theme-'));
|
|
54
|
-
if (typeof theme === 'string') {
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
parent = parent.parentElement;
|
|
58
|
-
}
|
|
59
|
-
return theme;
|
|
60
|
-
}
|
|
61
42
|
export class DockviewComponent extends BaseGrid {
|
|
62
43
|
get orientation() {
|
|
63
44
|
return this.gridview.orientation;
|
|
@@ -93,13 +74,12 @@ export class DockviewComponent extends BaseGrid {
|
|
|
93
74
|
}
|
|
94
75
|
constructor(parentElement, options) {
|
|
95
76
|
var _a;
|
|
96
|
-
super({
|
|
77
|
+
super(parentElement, {
|
|
97
78
|
proportionalLayout: true,
|
|
98
79
|
orientation: Orientation.HORIZONTAL,
|
|
99
80
|
styles: options.hideBorders
|
|
100
81
|
? { separatorBorder: 'transparent' }
|
|
101
82
|
: undefined,
|
|
102
|
-
parentElement: parentElement,
|
|
103
83
|
disableAutoResizing: options.disableAutoResizing,
|
|
104
84
|
locked: options.locked,
|
|
105
85
|
margin: options.gap,
|
|
@@ -139,9 +119,6 @@ export class DockviewComponent extends BaseGrid {
|
|
|
139
119
|
this._onDidActiveGroupChange = new Emitter();
|
|
140
120
|
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
141
121
|
this._moving = false;
|
|
142
|
-
// const gready = document.createElement('div');
|
|
143
|
-
// gready.className = 'dv-overlay-render-container';
|
|
144
|
-
// this.gridview.element.appendChild(gready);
|
|
145
122
|
this.overlayRenderContainer = new OverlayRenderContainer(this.gridview.element, this);
|
|
146
123
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
147
124
|
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
@@ -592,16 +569,11 @@ export class DockviewComponent extends BaseGrid {
|
|
|
592
569
|
}
|
|
593
570
|
}
|
|
594
571
|
updateOptions(options) {
|
|
595
|
-
var _a, _b;
|
|
572
|
+
var _a, _b, _c, _d;
|
|
596
573
|
super.updateOptions(options);
|
|
597
|
-
|
|
598
|
-
options.floatingGroupBounds !== this.options.floatingGroupBounds;
|
|
599
|
-
const changed_rootOverlayOptions = 'rootOverlayModel' in options &&
|
|
600
|
-
options.rootOverlayModel !== this.options.rootOverlayModel;
|
|
601
|
-
this._options = Object.assign(Object.assign({}, this.options), options);
|
|
602
|
-
if (changed_floatingGroupBounds) {
|
|
574
|
+
if ('floatingGroupBounds' in options) {
|
|
603
575
|
for (const group of this._floatingGroups) {
|
|
604
|
-
switch (
|
|
576
|
+
switch (options.floatingGroupBounds) {
|
|
605
577
|
case 'boundedWithinViewport':
|
|
606
578
|
group.overlay.minimumInViewportHeight = undefined;
|
|
607
579
|
group.overlay.minimumInViewportWidth = undefined;
|
|
@@ -614,25 +586,20 @@ export class DockviewComponent extends BaseGrid {
|
|
|
614
586
|
break;
|
|
615
587
|
default:
|
|
616
588
|
group.overlay.minimumInViewportHeight =
|
|
617
|
-
(_a =
|
|
589
|
+
(_a = options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;
|
|
618
590
|
group.overlay.minimumInViewportWidth =
|
|
619
|
-
(_b =
|
|
591
|
+
(_b = options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
|
|
620
592
|
}
|
|
621
593
|
group.overlay.setBounds();
|
|
622
594
|
}
|
|
623
595
|
}
|
|
624
|
-
if (
|
|
625
|
-
this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
|
|
626
|
-
}
|
|
627
|
-
if (
|
|
628
|
-
// if explicitly set as `undefined`
|
|
629
|
-
'gap' in options &&
|
|
630
|
-
options.gap === undefined) {
|
|
631
|
-
this.gridview.margin = 0;
|
|
596
|
+
if ('rootOverlayModel' in options) {
|
|
597
|
+
this._rootDropTarget.setOverlayModel((_c = options.rootOverlayModel) !== null && _c !== void 0 ? _c : DEFAULT_ROOT_OVERLAY_MODEL);
|
|
632
598
|
}
|
|
633
|
-
if (
|
|
634
|
-
this.gridview.margin = options.gap;
|
|
599
|
+
if ('gap' in options) {
|
|
600
|
+
this.gridview.margin = (_d = options.gap) !== null && _d !== void 0 ? _d : 0;
|
|
635
601
|
}
|
|
602
|
+
this._options = Object.assign(Object.assign({}, this.options), options);
|
|
636
603
|
this.layout(this.gridview.width, this.gridview.height, true);
|
|
637
604
|
}
|
|
638
605
|
layout(width, height, forceResize) {
|
|
@@ -889,6 +856,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
889
856
|
if (options.position && options.floating) {
|
|
890
857
|
throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
|
|
891
858
|
}
|
|
859
|
+
const initial = {
|
|
860
|
+
width: options.initialWidth,
|
|
861
|
+
height: options.initialHeight,
|
|
862
|
+
};
|
|
892
863
|
if (options.position) {
|
|
893
864
|
if (isPanelOptionsWithPanel(options.position)) {
|
|
894
865
|
const referencePanel = typeof options.position.referencePanel === 'string'
|
|
@@ -918,6 +889,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
918
889
|
if (!options.inactive) {
|
|
919
890
|
this.doSetGroupAndPanelActive(group);
|
|
920
891
|
}
|
|
892
|
+
group.api.setSize({
|
|
893
|
+
height: initial === null || initial === void 0 ? void 0 : initial.height,
|
|
894
|
+
width: initial === null || initial === void 0 ? void 0 : initial.width,
|
|
895
|
+
});
|
|
921
896
|
return panel;
|
|
922
897
|
}
|
|
923
898
|
}
|
|
@@ -948,6 +923,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
948
923
|
skipSetActive: options.inactive,
|
|
949
924
|
skipSetGroupActive: options.inactive,
|
|
950
925
|
});
|
|
926
|
+
referenceGroup.api.setSize({
|
|
927
|
+
width: initial === null || initial === void 0 ? void 0 : initial.width,
|
|
928
|
+
height: initial === null || initial === void 0 ? void 0 : initial.height,
|
|
929
|
+
});
|
|
951
930
|
if (!options.inactive) {
|
|
952
931
|
this.doSetGroupAndPanelActive(referenceGroup);
|
|
953
932
|
}
|
|
@@ -955,7 +934,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
955
934
|
else {
|
|
956
935
|
const location = getGridLocation(referenceGroup.element);
|
|
957
936
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
958
|
-
const group = this.createGroupAtLocation(relativeLocation)
|
|
937
|
+
const group = this.createGroupAtLocation(relativeLocation, this.orientationAtLocation(relativeLocation) ===
|
|
938
|
+
Orientation.VERTICAL
|
|
939
|
+
? initial === null || initial === void 0 ? void 0 : initial.height
|
|
940
|
+
: initial === null || initial === void 0 ? void 0 : initial.width);
|
|
959
941
|
panel = this.createPanel(options, group);
|
|
960
942
|
group.model.openPanel(panel, {
|
|
961
943
|
skipSetActive: options.inactive,
|
|
@@ -981,7 +963,9 @@ export class DockviewComponent extends BaseGrid {
|
|
|
981
963
|
});
|
|
982
964
|
}
|
|
983
965
|
else {
|
|
984
|
-
const group = this.createGroupAtLocation(
|
|
966
|
+
const group = this.createGroupAtLocation([0], this.gridview.orientation === Orientation.VERTICAL
|
|
967
|
+
? initial === null || initial === void 0 ? void 0 : initial.height
|
|
968
|
+
: initial === null || initial === void 0 ? void 0 : initial.width);
|
|
985
969
|
panel = this.createPanel(options, group);
|
|
986
970
|
group.model.openPanel(panel, {
|
|
987
971
|
skipSetActive: options.inactive,
|
|
@@ -1075,7 +1059,11 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1075
1059
|
const location = getGridLocation(referenceGroup.element);
|
|
1076
1060
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
1077
1061
|
const group = this.createGroup(options);
|
|
1078
|
-
this.
|
|
1062
|
+
const size = this.getLocationOrientation(relativeLocation) ===
|
|
1063
|
+
Orientation.VERTICAL
|
|
1064
|
+
? options.initialHeight
|
|
1065
|
+
: options.initialWidth;
|
|
1066
|
+
this.doAddGroup(group, relativeLocation, size);
|
|
1079
1067
|
if (!options.skipSetActive) {
|
|
1080
1068
|
this.doSetGroupAndPanelActive(group);
|
|
1081
1069
|
}
|
|
@@ -1088,6 +1076,12 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1088
1076
|
return group;
|
|
1089
1077
|
}
|
|
1090
1078
|
}
|
|
1079
|
+
getLocationOrientation(location) {
|
|
1080
|
+
return location.length % 2 == 0 &&
|
|
1081
|
+
this.gridview.orientation === Orientation.HORIZONTAL
|
|
1082
|
+
? Orientation.HORIZONTAL
|
|
1083
|
+
: Orientation.VERTICAL;
|
|
1084
|
+
}
|
|
1091
1085
|
removeGroup(group, options) {
|
|
1092
1086
|
this.doRemoveGroup(group, options);
|
|
1093
1087
|
}
|
|
@@ -1359,7 +1353,22 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1359
1353
|
}
|
|
1360
1354
|
const referenceLocation = getGridLocation(to.element);
|
|
1361
1355
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
1362
|
-
|
|
1356
|
+
let size;
|
|
1357
|
+
switch (this.gridview.orientation) {
|
|
1358
|
+
case Orientation.VERTICAL:
|
|
1359
|
+
size =
|
|
1360
|
+
referenceLocation.length % 2 == 0
|
|
1361
|
+
? from.api.width
|
|
1362
|
+
: from.api.height;
|
|
1363
|
+
break;
|
|
1364
|
+
case Orientation.HORIZONTAL:
|
|
1365
|
+
size =
|
|
1366
|
+
referenceLocation.length % 2 == 0
|
|
1367
|
+
? from.api.height
|
|
1368
|
+
: from.api.width;
|
|
1369
|
+
break;
|
|
1370
|
+
}
|
|
1371
|
+
this.gridview.addView(from, size, dropLocation);
|
|
1363
1372
|
}
|
|
1364
1373
|
from.panels.forEach((panel) => {
|
|
1365
1374
|
this._onDidMovePanel.fire({ panel, from });
|
|
@@ -1471,20 +1480,32 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1471
1480
|
const contentComponent = options.component;
|
|
1472
1481
|
const tabComponent = (_a = options.tabComponent) !== null && _a !== void 0 ? _a : this.options.defaultTabComponent;
|
|
1473
1482
|
const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
|
|
1474
|
-
const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, {
|
|
1483
|
+
const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, {
|
|
1484
|
+
renderer: options.renderer,
|
|
1485
|
+
minimumWidth: options.minimumWidth,
|
|
1486
|
+
minimumHeight: options.minimumHeight,
|
|
1487
|
+
maximumWidth: options.maximumWidth,
|
|
1488
|
+
maximumHeight: options.maximumHeight,
|
|
1489
|
+
});
|
|
1475
1490
|
panel.init({
|
|
1476
1491
|
title: (_b = options.title) !== null && _b !== void 0 ? _b : options.id,
|
|
1477
1492
|
params: (_c = options === null || options === void 0 ? void 0 : options.params) !== null && _c !== void 0 ? _c : {},
|
|
1478
1493
|
});
|
|
1479
1494
|
return panel;
|
|
1480
1495
|
}
|
|
1481
|
-
createGroupAtLocation(location
|
|
1496
|
+
createGroupAtLocation(location, size) {
|
|
1482
1497
|
const group = this.createGroup();
|
|
1483
|
-
this.doAddGroup(group, location);
|
|
1498
|
+
this.doAddGroup(group, location, size);
|
|
1484
1499
|
return group;
|
|
1485
1500
|
}
|
|
1486
1501
|
findGroup(panel) {
|
|
1487
1502
|
var _a;
|
|
1488
1503
|
return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
|
|
1489
1504
|
}
|
|
1505
|
+
orientationAtLocation(location) {
|
|
1506
|
+
const rootOrientation = this.gridview.orientation;
|
|
1507
|
+
return location.length % 2 == 1
|
|
1508
|
+
? rootOrientation
|
|
1509
|
+
: orthogonal(rootOrientation);
|
|
1510
|
+
}
|
|
1490
1511
|
}
|
|
@@ -14,6 +14,10 @@ export interface IDockviewGroupPanel extends IGridviewPanel<DockviewGroupPanelAp
|
|
|
14
14
|
export type IDockviewGroupPanelPublic = IDockviewGroupPanel;
|
|
15
15
|
export declare class DockviewGroupPanel extends GridviewPanel<DockviewGroupPanelApiImpl> implements IDockviewGroupPanel {
|
|
16
16
|
private readonly _model;
|
|
17
|
+
get minimumWidth(): number;
|
|
18
|
+
get minimumHeight(): number;
|
|
19
|
+
get maximumWidth(): number;
|
|
20
|
+
get maximumHeight(): number;
|
|
17
21
|
get panels(): IDockviewPanel[];
|
|
18
22
|
get activePanel(): IDockviewPanel | undefined;
|
|
19
23
|
get size(): number;
|
|
@@ -4,6 +4,34 @@ import { DockviewGroupPanelApiImpl, } from '../api/dockviewGroupPanelApi';
|
|
|
4
4
|
const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
|
|
5
5
|
const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
|
|
6
6
|
export class DockviewGroupPanel extends GridviewPanel {
|
|
7
|
+
get minimumWidth() {
|
|
8
|
+
var _a;
|
|
9
|
+
const activePanelMinimumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumWidth;
|
|
10
|
+
return typeof activePanelMinimumWidth === 'number'
|
|
11
|
+
? activePanelMinimumWidth
|
|
12
|
+
: MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH;
|
|
13
|
+
}
|
|
14
|
+
get minimumHeight() {
|
|
15
|
+
var _a;
|
|
16
|
+
const activePanelMinimumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumHeight;
|
|
17
|
+
return typeof activePanelMinimumHeight === 'number'
|
|
18
|
+
? activePanelMinimumHeight
|
|
19
|
+
: MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT;
|
|
20
|
+
}
|
|
21
|
+
get maximumWidth() {
|
|
22
|
+
var _a;
|
|
23
|
+
const activePanelMaximumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumWidth;
|
|
24
|
+
return typeof activePanelMaximumWidth === 'number'
|
|
25
|
+
? activePanelMaximumWidth
|
|
26
|
+
: Number.MAX_SAFE_INTEGER;
|
|
27
|
+
}
|
|
28
|
+
get maximumHeight() {
|
|
29
|
+
var _a;
|
|
30
|
+
const activePanelMaximumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumHeight;
|
|
31
|
+
return typeof activePanelMaximumHeight === 'number'
|
|
32
|
+
? activePanelMaximumHeight
|
|
33
|
+
: Number.MAX_SAFE_INTEGER;
|
|
34
|
+
}
|
|
7
35
|
get panels() {
|
|
8
36
|
return this._model.panels;
|
|
9
37
|
}
|
|
@@ -26,9 +54,12 @@ export class DockviewGroupPanel extends GridviewPanel {
|
|
|
26
54
|
return this._model.header;
|
|
27
55
|
}
|
|
28
56
|
constructor(accessor, id, options) {
|
|
57
|
+
var _a, _b, _c, _d, _e, _f;
|
|
29
58
|
super(id, 'groupview_default', {
|
|
30
|
-
minimumHeight: MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
|
|
31
|
-
minimumWidth: MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
|
|
59
|
+
minimumHeight: (_b = (_a = options.constraints) === null || _a === void 0 ? void 0 : _a.minimumHeight) !== null && _b !== void 0 ? _b : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
|
|
60
|
+
minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.maximumHeight) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
|
|
61
|
+
maximumHeight: (_e = options.constraints) === null || _e === void 0 ? void 0 : _e.maximumHeight,
|
|
62
|
+
maximumWidth: (_f = options.constraints) === null || _f === void 0 ? void 0 : _f.maximumWidth,
|
|
32
63
|
}, new DockviewGroupPanelApiImpl(id, accessor));
|
|
33
64
|
this.api.initialize(this); // cannot use 'this' after after 'super' call
|
|
34
65
|
this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
|
|
@@ -12,6 +12,7 @@ import { IDockviewPanel } from './dockviewPanel';
|
|
|
12
12
|
import { DockviewDndOverlayEvent } from './options';
|
|
13
13
|
import { OverlayRenderContainer } from '../overlay/overlayRenderContainer';
|
|
14
14
|
import { TitleEvent } from '../api/dockviewPanelApi';
|
|
15
|
+
import { Contraints } from '../gridview/gridviewPanel';
|
|
15
16
|
interface GroupMoveEvent {
|
|
16
17
|
groupId: string;
|
|
17
18
|
itemId?: string;
|
|
@@ -22,6 +23,9 @@ interface CoreGroupOptions {
|
|
|
22
23
|
locked?: DockviewGroupPanelLocked;
|
|
23
24
|
hideHeader?: boolean;
|
|
24
25
|
skipSetActive?: boolean;
|
|
26
|
+
constraints?: Partial<Contraints>;
|
|
27
|
+
initialWidth?: number;
|
|
28
|
+
initialHeight?: number;
|
|
25
29
|
}
|
|
26
30
|
export interface GroupOptions extends CoreGroupOptions {
|
|
27
31
|
readonly panels?: IDockviewPanel[];
|
|
@@ -540,7 +540,6 @@ export class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
540
540
|
});
|
|
541
541
|
this.tabsContainer.hide();
|
|
542
542
|
this.contentContainer.element.appendChild(this.watermark.element);
|
|
543
|
-
this.watermark.updateParentGroup(this.groupPanel, true);
|
|
544
543
|
}
|
|
545
544
|
if (!this.isEmpty && this.watermark) {
|
|
546
545
|
this.watermark.element.remove();
|
|
@@ -7,12 +7,17 @@ import { IPanel, PanelUpdateEvent, Parameters } from '../panel/types';
|
|
|
7
7
|
import { IDockviewPanelModel } from './dockviewPanelModel';
|
|
8
8
|
import { DockviewComponent } from './dockviewComponent';
|
|
9
9
|
import { DockviewPanelRenderer } from '../overlay/overlayRenderContainer';
|
|
10
|
+
import { Contraints } from '../gridview/gridviewPanel';
|
|
10
11
|
export interface IDockviewPanel extends IDisposable, IPanel {
|
|
11
12
|
readonly view: IDockviewPanelModel;
|
|
12
13
|
readonly group: DockviewGroupPanel;
|
|
13
14
|
readonly api: DockviewPanelApi;
|
|
14
15
|
readonly title: string | undefined;
|
|
15
16
|
readonly params: Parameters | undefined;
|
|
17
|
+
readonly minimumWidth?: number;
|
|
18
|
+
readonly minimumHeight?: number;
|
|
19
|
+
readonly maximumWidth?: number;
|
|
20
|
+
readonly maximumHeight?: number;
|
|
16
21
|
updateParentGroup(group: DockviewGroupPanel, options?: {
|
|
17
22
|
skipSetActive?: boolean;
|
|
18
23
|
}): void;
|
|
@@ -32,13 +37,21 @@ export declare class DockviewPanel extends CompositeDisposable implements IDockv
|
|
|
32
37
|
private _params?;
|
|
33
38
|
private _title;
|
|
34
39
|
private _renderer;
|
|
40
|
+
private _minimumWidth;
|
|
41
|
+
private _minimumHeight;
|
|
42
|
+
private _maximumWidth;
|
|
43
|
+
private _maximumHeight;
|
|
35
44
|
get params(): Parameters | undefined;
|
|
36
45
|
get title(): string | undefined;
|
|
37
46
|
get group(): DockviewGroupPanel;
|
|
38
47
|
get renderer(): DockviewPanelRenderer;
|
|
48
|
+
get minimumWidth(): number | undefined;
|
|
49
|
+
get minimumHeight(): number | undefined;
|
|
50
|
+
get maximumWidth(): number | undefined;
|
|
51
|
+
get maximumHeight(): number | undefined;
|
|
39
52
|
constructor(id: string, component: string, tabComponent: string | undefined, accessor: DockviewComponent, containerApi: DockviewApi, group: DockviewGroupPanel, view: IDockviewPanelModel, options: {
|
|
40
53
|
renderer?: DockviewPanelRenderer;
|
|
41
|
-
});
|
|
54
|
+
} & Partial<Contraints>);
|
|
42
55
|
init(params: IGroupPanelInitParameters): void;
|
|
43
56
|
focus(): void;
|
|
44
57
|
toJSON(): GroupviewPanelState;
|
|
@@ -15,6 +15,18 @@ export class DockviewPanel extends CompositeDisposable {
|
|
|
15
15
|
var _a;
|
|
16
16
|
return (_a = this._renderer) !== null && _a !== void 0 ? _a : this.accessor.renderer;
|
|
17
17
|
}
|
|
18
|
+
get minimumWidth() {
|
|
19
|
+
return this._minimumWidth;
|
|
20
|
+
}
|
|
21
|
+
get minimumHeight() {
|
|
22
|
+
return this._minimumHeight;
|
|
23
|
+
}
|
|
24
|
+
get maximumWidth() {
|
|
25
|
+
return this._maximumWidth;
|
|
26
|
+
}
|
|
27
|
+
get maximumHeight() {
|
|
28
|
+
return this._maximumHeight;
|
|
29
|
+
}
|
|
18
30
|
constructor(id, component, tabComponent, accessor, containerApi, group, view, options) {
|
|
19
31
|
super();
|
|
20
32
|
this.id = id;
|
|
@@ -23,6 +35,10 @@ export class DockviewPanel extends CompositeDisposable {
|
|
|
23
35
|
this.view = view;
|
|
24
36
|
this._renderer = options.renderer;
|
|
25
37
|
this._group = group;
|
|
38
|
+
this._minimumWidth = options.minimumWidth;
|
|
39
|
+
this._minimumHeight = options.minimumHeight;
|
|
40
|
+
this._maximumWidth = options.maximumWidth;
|
|
41
|
+
this._maximumHeight = options.maximumHeight;
|
|
26
42
|
this.api = new DockviewPanelApiImpl(this, this._group, accessor, component, tabComponent);
|
|
27
43
|
this.addDisposables(this.api.onActiveChange(() => {
|
|
28
44
|
accessor.setActivePanel(this);
|
|
@@ -59,6 +75,10 @@ export class DockviewPanel extends CompositeDisposable {
|
|
|
59
75
|
: undefined,
|
|
60
76
|
title: this.title,
|
|
61
77
|
renderer: this._renderer,
|
|
78
|
+
minimumHeight: this._minimumHeight,
|
|
79
|
+
maximumHeight: this._maximumHeight,
|
|
80
|
+
minimumWidth: this._minimumWidth,
|
|
81
|
+
maximumWidth: this._maximumWidth,
|
|
62
82
|
};
|
|
63
83
|
}
|
|
64
84
|
setTitle(title) {
|
|
@@ -12,6 +12,7 @@ import { IDockviewPanel } from './dockviewPanel';
|
|
|
12
12
|
import { DockviewPanelRenderer } from '../overlay/overlayRenderContainer';
|
|
13
13
|
import { IGroupHeaderProps } from './framework';
|
|
14
14
|
import { FloatingGroupOptions } from './dockviewComponent';
|
|
15
|
+
import { Contraints } from '../gridview/gridviewPanel';
|
|
15
16
|
export interface IHeaderActionsRenderer extends IDisposable {
|
|
16
17
|
readonly element: HTMLElement;
|
|
17
18
|
init(params: IGroupHeaderProps): void;
|
|
@@ -71,19 +72,23 @@ export declare class DockviewUnhandledDragOverEvent implements DockviewDndOverla
|
|
|
71
72
|
accept(): void;
|
|
72
73
|
}
|
|
73
74
|
export declare const PROPERTY_KEYS: (keyof DockviewOptions)[];
|
|
75
|
+
export interface CreateComponentOptions {
|
|
76
|
+
/**
|
|
77
|
+
* The unqiue identifer of the component
|
|
78
|
+
*/
|
|
79
|
+
id: string;
|
|
80
|
+
/**
|
|
81
|
+
* The component name, this should determine what is rendered.
|
|
82
|
+
*/
|
|
83
|
+
name: string;
|
|
84
|
+
}
|
|
74
85
|
export interface DockviewFrameworkOptions {
|
|
75
86
|
defaultTabComponent?: string;
|
|
76
87
|
createRightHeaderActionComponent?: (group: DockviewGroupPanel) => IHeaderActionsRenderer;
|
|
77
88
|
createLeftHeaderActionComponent?: (group: DockviewGroupPanel) => IHeaderActionsRenderer;
|
|
78
89
|
createPrefixHeaderActionComponent?: (group: DockviewGroupPanel) => IHeaderActionsRenderer;
|
|
79
|
-
createTabComponent?: (options:
|
|
80
|
-
|
|
81
|
-
name: string;
|
|
82
|
-
}) => ITabRenderer | undefined;
|
|
83
|
-
createComponent: (options: {
|
|
84
|
-
id: string;
|
|
85
|
-
name: string;
|
|
86
|
-
}) => IContentRenderer;
|
|
90
|
+
createTabComponent?: (options: CreateComponentOptions) => ITabRenderer | undefined;
|
|
91
|
+
createComponent: (options: CreateComponentOptions) => IContentRenderer;
|
|
87
92
|
createWatermarkComponent?: () => IWatermarkRenderer;
|
|
88
93
|
}
|
|
89
94
|
export type DockviewComponentOptions = DockviewOptions & DockviewFrameworkOptions;
|
|
@@ -149,7 +154,9 @@ export type AddPanelOptions<P extends object = Parameters> = {
|
|
|
149
154
|
* Defaults to `false` which forces newly added panels to become active.
|
|
150
155
|
*/
|
|
151
156
|
inactive?: boolean;
|
|
152
|
-
|
|
157
|
+
initialWidth?: number;
|
|
158
|
+
initialHeight?: number;
|
|
159
|
+
} & Partial<AddPanelOptionsUnion> & Partial<Contraints>;
|
|
153
160
|
type AddGroupOptionsWithPanel = {
|
|
154
161
|
referencePanel: string | IDockviewPanel;
|
|
155
162
|
direction?: Omit<Direction, 'within'>;
|
|
@@ -2,7 +2,7 @@ import { DockviewPanelApi } from '../api/dockviewPanelApi';
|
|
|
2
2
|
import { PanelInitParameters, IPanel } from '../panel/types';
|
|
3
3
|
import { DockviewApi } from '../api/component.api';
|
|
4
4
|
import { Optional } from '../types';
|
|
5
|
-
import {
|
|
5
|
+
import { IDockviewGroupPanel } from './dockviewGroupPanel';
|
|
6
6
|
import { DockviewPanelRenderer } from '../overlay/overlayRenderContainer';
|
|
7
7
|
export interface HeaderPartInitParameters {
|
|
8
8
|
title: string;
|
|
@@ -19,7 +19,6 @@ type RendererMethodOptionalList = 'dispose' | 'update' | 'layout' | 'toJSON' | '
|
|
|
19
19
|
export interface IWatermarkRenderer extends Optional<Omit<IPanel, 'id' | 'init'>, RendererMethodOptionalList> {
|
|
20
20
|
readonly element: HTMLElement;
|
|
21
21
|
init: (params: WatermarkRendererInitParameters) => void;
|
|
22
|
-
updateParentGroup(group: DockviewGroupPanel, visible: boolean): void;
|
|
23
22
|
}
|
|
24
23
|
export interface ITabRenderer extends Optional<Omit<IPanel, 'id'>, RendererMethodOptionalList> {
|
|
25
24
|
readonly element: HTMLElement;
|
|
@@ -40,5 +39,9 @@ export interface GroupviewPanelState {
|
|
|
40
39
|
params?: {
|
|
41
40
|
[key: string]: any;
|
|
42
41
|
};
|
|
42
|
+
minimumWidth?: number;
|
|
43
|
+
minimumHeight?: number;
|
|
44
|
+
maximumWidth?: number;
|
|
45
|
+
maximumHeight?: number;
|
|
43
46
|
}
|
|
44
47
|
export {};
|