dockview-core 4.13.1 → 5.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 +56 -8
- package/dist/cjs/api/dockviewGroupPanelApi.d.ts +5 -0
- package/dist/cjs/api/dockviewGroupPanelApi.js +13 -1
- package/dist/cjs/api/dockviewPanelApi.js +1 -1
- package/dist/cjs/constants.js +6 -1
- package/dist/cjs/dnd/abstractDragHandler.js +3 -1
- package/dist/cjs/dnd/droptarget.js +2 -2
- package/dist/cjs/dockview/components/popupService.js +2 -0
- package/dist/cjs/dockview/components/titlebar/tabs.d.ts +5 -0
- package/dist/cjs/dockview/components/titlebar/tabs.js +31 -4
- package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +5 -0
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +21 -0
- package/dist/cjs/dockview/deserializer.js +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts +2 -1
- package/dist/cjs/dockview/dockviewComponent.js +73 -47
- package/dist/cjs/dockview/dockviewGroupPanel.js +16 -13
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +11 -1
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +62 -5
- package/dist/cjs/dockview/framework.d.ts +2 -0
- package/dist/cjs/dockview/options.d.ts +3 -0
- package/dist/cjs/dockview/options.js +1 -0
- package/dist/cjs/dom.js +9 -1
- package/dist/cjs/framwork.d.ts +1 -1
- package/dist/cjs/lifecycle.d.ts +2 -1
- package/dist/cjs/lifecycle.js +6 -3
- package/dist/cjs/overlay/overlay.js +2 -1
- package/dist/cjs/scrollbar.d.ts +5 -2
- package/dist/cjs/scrollbar.js +88 -26
- package/dist/dockview-core.js +265 -66
- 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 +264 -65
- package/dist/esm/api/dockviewGroupPanelApi.d.ts +5 -0
- package/dist/esm/api/dockviewGroupPanelApi.js +14 -2
- package/dist/esm/api/dockviewPanelApi.js +1 -1
- package/dist/esm/constants.js +6 -1
- package/dist/esm/dnd/abstractDragHandler.js +3 -1
- package/dist/esm/dnd/droptarget.js +2 -2
- package/dist/esm/dockview/components/popupService.js +2 -0
- package/dist/esm/dockview/components/titlebar/tabs.d.ts +5 -0
- package/dist/esm/dockview/components/titlebar/tabs.js +28 -5
- package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +5 -0
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +18 -1
- package/dist/esm/dockview/deserializer.js +1 -1
- package/dist/esm/dockview/dockviewComponent.d.ts +2 -1
- package/dist/esm/dockview/dockviewComponent.js +15 -3
- package/dist/esm/dockview/dockviewGroupPanel.js +17 -14
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +11 -1
- package/dist/esm/dockview/dockviewGroupPanelModel.js +61 -8
- package/dist/esm/dockview/framework.d.ts +2 -0
- package/dist/esm/dockview/options.d.ts +3 -0
- package/dist/esm/dockview/options.js +1 -0
- package/dist/esm/dom.js +9 -1
- package/dist/esm/framwork.d.ts +1 -1
- package/dist/esm/lifecycle.d.ts +2 -1
- package/dist/esm/lifecycle.js +6 -3
- package/dist/esm/overlay/overlay.js +2 -1
- package/dist/esm/scrollbar.d.ts +5 -2
- package/dist/esm/scrollbar.js +85 -27
- package/dist/{dockview-core.cjs.js → package/main.cjs.js} +265 -66
- package/dist/package/main.cjs.min.js +7 -0
- package/dist/package/main.esm.min.mjs +7 -0
- package/dist/{dockview-core.esm.js → package/main.esm.mjs} +265 -66
- package/dist/styles/dockview.css +63 -7
- package/package.json +63 -53
- package/dist/dockview-core.amd.js +0 -11373
- package/dist/dockview-core.amd.js.map +0 -1
- package/dist/dockview-core.amd.min.js +0 -8
- package/dist/dockview-core.amd.min.js.map +0 -1
- package/dist/dockview-core.amd.min.noStyle.js +0 -8
- package/dist/dockview-core.amd.min.noStyle.js.map +0 -1
- package/dist/dockview-core.amd.noStyle.js +0 -11343
- package/dist/dockview-core.amd.noStyle.js.map +0 -1
- package/dist/dockview-core.cjs.js.map +0 -1
- package/dist/dockview-core.esm.js.map +0 -1
- package/dist/dockview-core.esm.min.js +0 -8
- package/dist/dockview-core.esm.min.js.map +0 -1
- package/dist/dockview-core.js.map +0 -1
- package/dist/dockview-core.noStyle.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { positionToDirection } from '../dnd/droptarget';
|
|
2
2
|
import { Emitter } from '../events';
|
|
3
|
-
import { GridviewPanelApiImpl } from './gridviewPanelApi';
|
|
3
|
+
import { GridviewPanelApiImpl, } from './gridviewPanelApi';
|
|
4
4
|
const NOT_INITIALIZED_MESSAGE = 'dockview: DockviewGroupPanelApiImpl not initialized';
|
|
5
5
|
export class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
6
6
|
get location() {
|
|
@@ -41,6 +41,18 @@ export class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
41
41
|
? this.location.getWindow()
|
|
42
42
|
: window;
|
|
43
43
|
}
|
|
44
|
+
setHeaderPosition(position) {
|
|
45
|
+
if (!this._group) {
|
|
46
|
+
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
47
|
+
}
|
|
48
|
+
this._group.model.headerPosition = position;
|
|
49
|
+
}
|
|
50
|
+
getHeaderPosition() {
|
|
51
|
+
if (!this._group) {
|
|
52
|
+
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
53
|
+
}
|
|
54
|
+
return this._group.model.headerPosition;
|
|
55
|
+
}
|
|
44
56
|
moveTo(options) {
|
|
45
57
|
var _a, _b, _c, _d;
|
|
46
58
|
if (!this._group) {
|
|
@@ -55,7 +67,7 @@ export class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
55
67
|
to: {
|
|
56
68
|
group,
|
|
57
69
|
position: options.group
|
|
58
|
-
? (_d = options.position) !== null && _d !== void 0 ? _d : 'center'
|
|
70
|
+
? ((_d = options.position) !== null && _d !== void 0 ? _d : 'center')
|
|
59
71
|
: 'center',
|
|
60
72
|
index: options.index,
|
|
61
73
|
},
|
|
@@ -62,7 +62,7 @@ export class DockviewPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
62
62
|
to: {
|
|
63
63
|
group: (_a = options.group) !== null && _a !== void 0 ? _a : this._group,
|
|
64
64
|
position: options.group
|
|
65
|
-
? (_b = options.position) !== null && _b !== void 0 ? _b : 'center'
|
|
65
|
+
? ((_b = options.position) !== null && _b !== void 0 ? _b : 'center')
|
|
66
66
|
: 'center',
|
|
67
67
|
index: options.index,
|
|
68
68
|
},
|
package/dist/esm/constants.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
|
2
|
-
export const DEFAULT_FLOATING_GROUP_POSITION = {
|
|
2
|
+
export const DEFAULT_FLOATING_GROUP_POSITION = {
|
|
3
|
+
left: 100,
|
|
4
|
+
top: 100,
|
|
5
|
+
width: 300,
|
|
6
|
+
height: 300,
|
|
7
|
+
};
|
|
3
8
|
export const DESERIALIZATION_POPOUT_DELAY_MS = 100;
|
|
@@ -21,7 +21,9 @@ export class DragHandler extends CompositeDisposable {
|
|
|
21
21
|
}
|
|
22
22
|
configure() {
|
|
23
23
|
this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
|
|
24
|
-
if (event.defaultPrevented ||
|
|
24
|
+
if (event.defaultPrevented ||
|
|
25
|
+
this.isCancelled(event) ||
|
|
26
|
+
this.disabled) {
|
|
25
27
|
event.preventDefault();
|
|
26
28
|
return;
|
|
27
29
|
}
|
|
@@ -40,10 +40,10 @@ function checkBoundsChanged(element, bounds) {
|
|
|
40
40
|
const widthPx = `${Math.round(width)}px`;
|
|
41
41
|
const heightPx = `${Math.round(height)}px`;
|
|
42
42
|
// Check if position or size changed (back to traditional method)
|
|
43
|
-
return element.style.top !== topPx ||
|
|
43
|
+
return (element.style.top !== topPx ||
|
|
44
44
|
element.style.left !== leftPx ||
|
|
45
45
|
element.style.width !== widthPx ||
|
|
46
|
-
element.style.height !== heightPx;
|
|
46
|
+
element.style.height !== heightPx);
|
|
47
47
|
}
|
|
48
48
|
export class WillShowOverlayEvent extends DockviewEvent {
|
|
49
49
|
get nativeEvent() {
|
|
@@ -43,6 +43,8 @@ export class PopupService extends CompositeDisposable {
|
|
|
43
43
|
return; // clicked within popover
|
|
44
44
|
}
|
|
45
45
|
this.close();
|
|
46
|
+
}), addDisposableListener(window, 'resize', () => {
|
|
47
|
+
this.close();
|
|
46
48
|
}));
|
|
47
49
|
requestAnimationFrame(() => {
|
|
48
50
|
shiftAbsoluteElementIntoView(wrapper, this.root);
|
|
@@ -4,6 +4,7 @@ import { DockviewComponent } from '../../dockviewComponent';
|
|
|
4
4
|
import { DockviewGroupPanel } from '../../dockviewGroupPanel';
|
|
5
5
|
import { DockviewWillShowOverlayLocationEvent } from '../../events';
|
|
6
6
|
import { IDockviewPanel } from '../../dockviewPanel';
|
|
7
|
+
import { DockviewHeaderDirection } from '../../options';
|
|
7
8
|
import { Tab } from '../tab/tab';
|
|
8
9
|
import { TabDragEvent, TabDropIndexEvent } from './tabsContainer';
|
|
9
10
|
export declare class Tabs extends CompositeDisposable {
|
|
@@ -12,9 +13,11 @@ export declare class Tabs extends CompositeDisposable {
|
|
|
12
13
|
private readonly _element;
|
|
13
14
|
private readonly _tabsList;
|
|
14
15
|
private readonly _observerDisposable;
|
|
16
|
+
private readonly _scrollbar;
|
|
15
17
|
private _tabs;
|
|
16
18
|
private selectedIndex;
|
|
17
19
|
private _showTabsOverflowControl;
|
|
20
|
+
private _direction;
|
|
18
21
|
private readonly _onTabDragStart;
|
|
19
22
|
readonly onTabDragStart: Event<TabDragEvent>;
|
|
20
23
|
private readonly _onDrop;
|
|
@@ -32,6 +35,8 @@ export declare class Tabs extends CompositeDisposable {
|
|
|
32
35
|
get panels(): string[];
|
|
33
36
|
get size(): number;
|
|
34
37
|
get tabs(): Tab[];
|
|
38
|
+
get direction(): DockviewHeaderDirection;
|
|
39
|
+
set direction(value: DockviewHeaderDirection);
|
|
35
40
|
constructor(group: DockviewGroupPanel, accessor: DockviewComponent, options: {
|
|
36
41
|
showTabsOverflowControl: boolean;
|
|
37
42
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getPanelData } from '../../../dnd/dataTransfer';
|
|
2
|
-
import { isChildEntirelyVisibleWithinParent, OverflowObserver, } from '../../../dom';
|
|
2
|
+
import { addClasses, isChildEntirelyVisibleWithinParent, OverflowObserver, removeClasses, } from '../../../dom';
|
|
3
3
|
import { addDisposableListener, Emitter } from '../../../events';
|
|
4
4
|
import { CompositeDisposable, Disposable, MutableDisposable, } from '../../../lifecycle';
|
|
5
5
|
import { Scrollbar } from '../../../scrollbar';
|
|
@@ -36,14 +36,36 @@ export class Tabs extends CompositeDisposable {
|
|
|
36
36
|
get tabs() {
|
|
37
37
|
return this._tabs.map((_) => _.value);
|
|
38
38
|
}
|
|
39
|
+
get direction() {
|
|
40
|
+
return this._direction;
|
|
41
|
+
}
|
|
42
|
+
set direction(value) {
|
|
43
|
+
if (this._direction === value) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this._direction = value;
|
|
47
|
+
if (this._scrollbar) {
|
|
48
|
+
this._scrollbar.orientation = value;
|
|
49
|
+
}
|
|
50
|
+
removeClasses(this._tabsList, 'dv-horizontal', 'dv-vertical');
|
|
51
|
+
if (value === 'vertical') {
|
|
52
|
+
addClasses(this._tabsList, 'dv-tabs-container-vertical', 'dv-vertical');
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
removeClasses(this._tabsList, 'dv-tabs-container-vertical');
|
|
56
|
+
addClasses(this._tabsList, 'dv-horizontal');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
39
59
|
constructor(group, accessor, options) {
|
|
40
60
|
super();
|
|
41
61
|
this.group = group;
|
|
42
62
|
this.accessor = accessor;
|
|
43
63
|
this._observerDisposable = new MutableDisposable();
|
|
64
|
+
this._scrollbar = null;
|
|
44
65
|
this._tabs = [];
|
|
45
66
|
this.selectedIndex = -1;
|
|
46
67
|
this._showTabsOverflowControl = false;
|
|
68
|
+
this._direction = 'horizontal';
|
|
47
69
|
this._onTabDragStart = new Emitter();
|
|
48
70
|
this.onTabDragStart = this._onTabDragStart.event;
|
|
49
71
|
this._onDrop = new Emitter();
|
|
@@ -53,15 +75,16 @@ export class Tabs extends CompositeDisposable {
|
|
|
53
75
|
this._onOverflowTabsChange = new Emitter();
|
|
54
76
|
this.onOverflowTabsChange = this._onOverflowTabsChange.event;
|
|
55
77
|
this._tabsList = document.createElement('div');
|
|
56
|
-
this._tabsList.className = 'dv-tabs-container
|
|
78
|
+
this._tabsList.className = 'dv-tabs-container';
|
|
57
79
|
this.showTabsOverflowControl = options.showTabsOverflowControl;
|
|
58
80
|
if (accessor.options.scrollbars === 'native') {
|
|
59
81
|
this._element = this._tabsList;
|
|
60
82
|
}
|
|
61
83
|
else {
|
|
62
|
-
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
84
|
+
this._scrollbar = new Scrollbar(this._tabsList);
|
|
85
|
+
this._scrollbar.orientation = this.direction;
|
|
86
|
+
this._element = this._scrollbar.element;
|
|
87
|
+
this.addDisposables(this._scrollbar);
|
|
65
88
|
}
|
|
66
89
|
this.addDisposables(this._onOverflowTabsChange, this._observerDisposable, this._onWillShowOverlay, this._onDrop, this._onTabDragStart, addDisposableListener(this.element, 'pointerdown', (event) => {
|
|
67
90
|
if (event.defaultPrevented) {
|
|
@@ -5,6 +5,7 @@ import { DockviewGroupPanel } from '../../dockviewGroupPanel';
|
|
|
5
5
|
import { IDockviewPanel } from '../../dockviewPanel';
|
|
6
6
|
import { DockviewComponent } from '../../dockviewComponent';
|
|
7
7
|
import { DockviewWillShowOverlayLocationEvent } from '../../events';
|
|
8
|
+
import { DockviewHeaderDirection } from '../../options';
|
|
8
9
|
export interface TabDropIndexEvent {
|
|
9
10
|
readonly event: DragEvent;
|
|
10
11
|
readonly index: number;
|
|
@@ -26,6 +27,7 @@ export interface ITabsContainer extends IDisposable {
|
|
|
26
27
|
readonly onGroupDragStart: Event<GroupDragEvent>;
|
|
27
28
|
readonly onWillShowOverlay: Event<DockviewWillShowOverlayLocationEvent>;
|
|
28
29
|
hidden: boolean;
|
|
30
|
+
direction: DockviewHeaderDirection;
|
|
29
31
|
delete(id: string): void;
|
|
30
32
|
indexOf(id: string): number;
|
|
31
33
|
setActive(isGroupActive: boolean): void;
|
|
@@ -53,6 +55,7 @@ export declare class TabsContainer extends CompositeDisposable implements ITabsC
|
|
|
53
55
|
private leftActions;
|
|
54
56
|
private preActions;
|
|
55
57
|
private _hidden;
|
|
58
|
+
private _direction;
|
|
56
59
|
private dropdownPart;
|
|
57
60
|
private _overflowTabs;
|
|
58
61
|
private readonly _dropdownDisposable;
|
|
@@ -67,6 +70,8 @@ export declare class TabsContainer extends CompositeDisposable implements ITabsC
|
|
|
67
70
|
get size(): number;
|
|
68
71
|
get hidden(): boolean;
|
|
69
72
|
set hidden(value: boolean);
|
|
73
|
+
get direction(): DockviewHeaderDirection;
|
|
74
|
+
set direction(value: DockviewHeaderDirection);
|
|
70
75
|
get element(): HTMLElement;
|
|
71
76
|
constructor(accessor: DockviewComponent, group: DockviewGroupPanel);
|
|
72
77
|
show(): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CompositeDisposable, Disposable, MutableDisposable, } from '../../../lifecycle';
|
|
2
2
|
import { addDisposableListener, Emitter } from '../../../events';
|
|
3
3
|
import { VoidContainer } from './voidContainer';
|
|
4
|
-
import { findRelativeZIndexParent, toggleClass } from '../../../dom';
|
|
4
|
+
import { addClasses, findRelativeZIndexParent, removeClasses, toggleClass, } from '../../../dom';
|
|
5
5
|
import { DockviewWillShowOverlayLocationEvent } from '../../events';
|
|
6
6
|
import { getPanelData } from '../../../dnd/dataTransfer';
|
|
7
7
|
import { Tabs } from './tabs';
|
|
@@ -23,6 +23,22 @@ export class TabsContainer extends CompositeDisposable {
|
|
|
23
23
|
this._hidden = value;
|
|
24
24
|
this.element.style.display = value ? 'none' : '';
|
|
25
25
|
}
|
|
26
|
+
get direction() {
|
|
27
|
+
return this._direction;
|
|
28
|
+
}
|
|
29
|
+
set direction(value) {
|
|
30
|
+
this._direction = value;
|
|
31
|
+
if (value === 'vertical') {
|
|
32
|
+
addClasses(this._element, 'dv-groupview-header-vertical');
|
|
33
|
+
addClasses(this.rightActionsContainer, 'dv-right-actions-container-vertical');
|
|
34
|
+
this.tabs.direction = value;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
removeClasses(this._element, 'dv-groupview-header-vertical');
|
|
38
|
+
removeClasses(this.rightActionsContainer, 'dv-right-actions-container-vertical');
|
|
39
|
+
this.tabs.direction = value;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
26
42
|
get element() {
|
|
27
43
|
return this._element;
|
|
28
44
|
}
|
|
@@ -31,6 +47,7 @@ export class TabsContainer extends CompositeDisposable {
|
|
|
31
47
|
this.accessor = accessor;
|
|
32
48
|
this.group = group;
|
|
33
49
|
this._hidden = false;
|
|
50
|
+
this._direction = 'horizontal';
|
|
34
51
|
this.dropdownPart = null;
|
|
35
52
|
this._overflowTabs = [];
|
|
36
53
|
this._dropdownDisposable = new MutableDisposable();
|
|
@@ -13,7 +13,7 @@ export class DefaultDockviewDeserialzier {
|
|
|
13
13
|
const viewData = panelData.view;
|
|
14
14
|
const contentComponent = viewData
|
|
15
15
|
? viewData.content.id
|
|
16
|
-
: (_a = panelData.contentComponent) !== null && _a !== void 0 ? _a : 'unknown';
|
|
16
|
+
: ((_a = panelData.contentComponent) !== null && _a !== void 0 ? _a : 'unknown');
|
|
17
17
|
const tabComponent = viewData
|
|
18
18
|
? (_b = viewData.tab) === null || _b === void 0 ? void 0 : _b.id
|
|
19
19
|
: panelData.tabComponent;
|
|
@@ -3,7 +3,7 @@ import { Position } from '../dnd/droptarget';
|
|
|
3
3
|
import { DockviewPanel, IDockviewPanel } from './dockviewPanel';
|
|
4
4
|
import { Event, Emitter } from '../events';
|
|
5
5
|
import { IWatermarkRenderer, GroupviewPanelState } from './types';
|
|
6
|
-
import { AddGroupOptions, AddPanelOptions, DockviewComponentOptions, DockviewDndOverlayEvent, DockviewOptions, MovementOptions } from './options';
|
|
6
|
+
import { AddGroupOptions, AddPanelOptions, DockviewComponentOptions, DockviewDndOverlayEvent, DockviewOptions, MovementOptions, DockviewHeaderPosition } from './options';
|
|
7
7
|
import { BaseGrid, IBaseGrid } from '../gridview/baseComponentGridview';
|
|
8
8
|
import { DockviewApi } from '../api/component.api';
|
|
9
9
|
import { Orientation } from '../splitview/splitview';
|
|
@@ -238,6 +238,7 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
|
|
|
238
238
|
get options(): DockviewComponentOptions;
|
|
239
239
|
get activePanel(): IDockviewPanel | undefined;
|
|
240
240
|
get renderer(): DockviewPanelRenderer;
|
|
241
|
+
get defaultHeaderPosition(): DockviewHeaderPosition;
|
|
241
242
|
get api(): DockviewApi;
|
|
242
243
|
get floatingGroups(): DockviewFloatingGroupPanel[];
|
|
243
244
|
/**
|
|
@@ -68,6 +68,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
68
68
|
var _a;
|
|
69
69
|
return (_a = this.options.defaultRenderer) !== null && _a !== void 0 ? _a : 'onlyWhenVisible';
|
|
70
70
|
}
|
|
71
|
+
get defaultHeaderPosition() {
|
|
72
|
+
var _a;
|
|
73
|
+
return (_a = this.options.defaultHeaderPosition) !== null && _a !== void 0 ? _a : 'top';
|
|
74
|
+
}
|
|
71
75
|
get api() {
|
|
72
76
|
return this._api;
|
|
73
77
|
}
|
|
@@ -637,9 +641,9 @@ export class DockviewComponent extends BaseGrid {
|
|
|
637
641
|
const anchoredBox = getAnchoredBox();
|
|
638
642
|
const overlay = new Overlay(Object.assign(Object.assign({ container: this.gridview.element, content: group.element }, anchoredBox), { minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
639
643
|
? undefined
|
|
640
|
-
: (_c = (_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport) !== null && _c !== void 0 ? _c : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE, minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
644
|
+
: ((_c = (_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport) !== null && _c !== void 0 ? _c : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE), minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
641
645
|
? undefined
|
|
642
|
-
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
|
|
646
|
+
: ((_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE) }));
|
|
643
647
|
const el = group.element.querySelector('.dv-void-container');
|
|
644
648
|
if (!el) {
|
|
645
649
|
throw new Error('dockview: failed to find drag handle');
|
|
@@ -754,6 +758,13 @@ export class DockviewComponent extends BaseGrid {
|
|
|
754
758
|
if ('theme' in options) {
|
|
755
759
|
this.updateTheme();
|
|
756
760
|
}
|
|
761
|
+
if ('createRightHeaderActionComponent' in options ||
|
|
762
|
+
'createLeftHeaderActionComponent' in options ||
|
|
763
|
+
'createPrefixHeaderActionComponent' in options) {
|
|
764
|
+
for (const group of this.groups) {
|
|
765
|
+
group.model.updateHeaderActions();
|
|
766
|
+
}
|
|
767
|
+
}
|
|
757
768
|
this.layout(this.gridview.width, this.gridview.height, true);
|
|
758
769
|
}
|
|
759
770
|
layout(width, height, forceResize) {
|
|
@@ -910,7 +921,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
910
921
|
const width = this.width;
|
|
911
922
|
const height = this.height;
|
|
912
923
|
const createGroupFromSerializedState = (data) => {
|
|
913
|
-
const { id, locked, hideHeader, views, activeView } = data;
|
|
924
|
+
const { id, locked, hideHeader, headerPosition, views, activeView, } = data;
|
|
914
925
|
if (typeof id !== 'string') {
|
|
915
926
|
throw new Error('dockview: group id must be of type string');
|
|
916
927
|
}
|
|
@@ -918,6 +929,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
918
929
|
id,
|
|
919
930
|
locked: !!locked,
|
|
920
931
|
hideHeader: !!hideHeader,
|
|
932
|
+
headerPosition,
|
|
921
933
|
});
|
|
922
934
|
this._onDidAddGroup.fire(group);
|
|
923
935
|
const createdPanels = [];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DockviewGroupPanelModel, } from './dockviewGroupPanelModel';
|
|
2
|
-
import { GridviewPanel } from '../gridview/gridviewPanel';
|
|
2
|
+
import { GridviewPanel, } from '../gridview/gridviewPanel';
|
|
3
3
|
import { DockviewGroupPanelApiImpl, } from '../api/dockviewGroupPanelApi';
|
|
4
|
-
// GridConstraintChangeEvent2 is not exported, so we'll type it manually
|
|
5
4
|
const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
|
|
6
5
|
const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
|
|
7
6
|
export class DockviewGroupPanel extends GridviewPanel {
|
|
@@ -92,24 +91,28 @@ export class DockviewGroupPanel extends GridviewPanel {
|
|
|
92
91
|
// Track explicitly set constraints to override panel constraints
|
|
93
92
|
// Extract numeric values from functions or values
|
|
94
93
|
if (event.minimumWidth !== undefined) {
|
|
95
|
-
this._explicitConstraints.minimumWidth =
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
this._explicitConstraints.minimumWidth =
|
|
95
|
+
typeof event.minimumWidth === 'function'
|
|
96
|
+
? event.minimumWidth()
|
|
97
|
+
: event.minimumWidth;
|
|
98
98
|
}
|
|
99
99
|
if (event.minimumHeight !== undefined) {
|
|
100
|
-
this._explicitConstraints.minimumHeight =
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
this._explicitConstraints.minimumHeight =
|
|
101
|
+
typeof event.minimumHeight === 'function'
|
|
102
|
+
? event.minimumHeight()
|
|
103
|
+
: event.minimumHeight;
|
|
103
104
|
}
|
|
104
105
|
if (event.maximumWidth !== undefined) {
|
|
105
|
-
this._explicitConstraints.maximumWidth =
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
this._explicitConstraints.maximumWidth =
|
|
107
|
+
typeof event.maximumWidth === 'function'
|
|
108
|
+
? event.maximumWidth()
|
|
109
|
+
: event.maximumWidth;
|
|
108
110
|
}
|
|
109
111
|
if (event.maximumHeight !== undefined) {
|
|
110
|
-
this._explicitConstraints.maximumHeight =
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
this._explicitConstraints.maximumHeight =
|
|
113
|
+
typeof event.maximumHeight === 'function'
|
|
114
|
+
? event.maximumHeight()
|
|
115
|
+
: event.maximumHeight;
|
|
113
116
|
}
|
|
114
117
|
}));
|
|
115
118
|
}
|
|
@@ -10,7 +10,7 @@ import { IPanel, PanelInitParameters, PanelUpdateEvent, Parameters } from '../pa
|
|
|
10
10
|
import { GroupDragEvent, TabDragEvent } from './components/titlebar/tabsContainer';
|
|
11
11
|
import { DockviewGroupPanel } from './dockviewGroupPanel';
|
|
12
12
|
import { IDockviewPanel } from './dockviewPanel';
|
|
13
|
-
import { DockviewDndOverlayEvent } from './options';
|
|
13
|
+
import { DockviewDndOverlayEvent, DockviewHeaderDirection, DockviewHeaderPosition } from './options';
|
|
14
14
|
import { OverlayRenderContainer } from '../overlay/overlayRenderContainer';
|
|
15
15
|
import { TitleEvent } from '../api/dockviewPanelApi';
|
|
16
16
|
import { Contraints } from '../gridview/gridviewPanel';
|
|
@@ -24,6 +24,7 @@ interface GroupMoveEvent {
|
|
|
24
24
|
interface CoreGroupOptions {
|
|
25
25
|
locked?: DockviewGroupPanelLocked;
|
|
26
26
|
hideHeader?: boolean;
|
|
27
|
+
headerPosition?: 'top' | 'bottom' | 'left' | 'right';
|
|
27
28
|
skipSetActive?: boolean;
|
|
28
29
|
constraints?: Partial<Contraints>;
|
|
29
30
|
initialWidth?: number;
|
|
@@ -74,6 +75,7 @@ export declare class DockviewWillDropEvent extends DockviewDidDropEvent {
|
|
|
74
75
|
}
|
|
75
76
|
export interface IHeader {
|
|
76
77
|
hidden: boolean;
|
|
78
|
+
direction: DockviewHeaderDirection;
|
|
77
79
|
}
|
|
78
80
|
export type DockviewGroupPanelLocked = boolean | 'no-drop-target';
|
|
79
81
|
export interface IDockviewGroupPanelModel extends IPanel {
|
|
@@ -90,6 +92,7 @@ export interface IDockviewGroupPanelModel extends IPanel {
|
|
|
90
92
|
readonly onDidActivePanelChange: Event<DockviewGroupChangeEvent>;
|
|
91
93
|
readonly onMove: Event<GroupMoveEvent>;
|
|
92
94
|
locked: DockviewGroupPanelLocked;
|
|
95
|
+
headerPosition: DockviewHeaderPosition;
|
|
93
96
|
setActive(isActive: boolean): void;
|
|
94
97
|
initialize(): void;
|
|
95
98
|
isPanelActive: (panel: IDockviewPanel) => boolean;
|
|
@@ -138,6 +141,10 @@ export declare class DockviewGroupPanelModel extends CompositeDisposable impleme
|
|
|
138
141
|
private _rightHeaderActions;
|
|
139
142
|
private _leftHeaderActions;
|
|
140
143
|
private _prefixHeaderActions;
|
|
144
|
+
private readonly _rightHeaderActionsDisposable;
|
|
145
|
+
private readonly _leftHeaderActionsDisposable;
|
|
146
|
+
private readonly _prefixHeaderActionsDisposable;
|
|
147
|
+
private _headerPosition;
|
|
141
148
|
private _location;
|
|
142
149
|
private mostRecentlyUsed;
|
|
143
150
|
private _overwriteRenderContainer;
|
|
@@ -184,6 +191,8 @@ export declare class DockviewGroupPanelModel extends CompositeDisposable impleme
|
|
|
184
191
|
get hasWatermark(): boolean;
|
|
185
192
|
get header(): IHeader;
|
|
186
193
|
get isContentFocused(): boolean;
|
|
194
|
+
get headerPosition(): DockviewHeaderPosition;
|
|
195
|
+
set headerPosition(value: DockviewHeaderPosition);
|
|
187
196
|
get location(): DockviewGroupLocation;
|
|
188
197
|
set location(value: DockviewGroupLocation);
|
|
189
198
|
constructor(container: HTMLElement, accessor: DockviewComponent, id: string, options: GroupOptions, groupPanel: DockviewGroupPanel);
|
|
@@ -193,6 +202,7 @@ export declare class DockviewGroupPanelModel extends CompositeDisposable impleme
|
|
|
193
202
|
set dropTargetContainer(value: DropTargetAnchorContainer | null);
|
|
194
203
|
get dropTargetContainer(): DropTargetAnchorContainer | null;
|
|
195
204
|
initialize(): void;
|
|
205
|
+
updateHeaderActions(): void;
|
|
196
206
|
rerender(panel: IDockviewPanel): void;
|
|
197
207
|
indexOf(panel: IDockviewPanel): number;
|
|
198
208
|
toJSON(): GroupPanelViewState;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DockviewApi } from '../api/component.api';
|
|
2
2
|
import { getPanelData } from '../dnd/dataTransfer';
|
|
3
|
-
import { isAncestor, toggleClass } from '../dom';
|
|
3
|
+
import { addClasses, isAncestor, removeClasses, toggleClass } from '../dom';
|
|
4
4
|
import { addDisposableListener, DockviewEvent, Emitter, } from '../events';
|
|
5
|
-
import { DockviewWillShowOverlayLocationEvent } from './events';
|
|
6
|
-
import { CompositeDisposable } from '../lifecycle';
|
|
5
|
+
import { DockviewWillShowOverlayLocationEvent, } from './events';
|
|
6
|
+
import { CompositeDisposable, MutableDisposable, } from '../lifecycle';
|
|
7
7
|
import { ContentContainer, } from './components/panel/content';
|
|
8
8
|
import { TabsContainer, } from './components/titlebar/tabsContainer';
|
|
9
9
|
import { DockviewUnhandledDragOverEvent, } from './options';
|
|
@@ -78,6 +78,29 @@ export class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
78
78
|
}
|
|
79
79
|
return isAncestor(document.activeElement, this.contentContainer.element);
|
|
80
80
|
}
|
|
81
|
+
get headerPosition() {
|
|
82
|
+
var _a;
|
|
83
|
+
return (_a = this._headerPosition) !== null && _a !== void 0 ? _a : 'top';
|
|
84
|
+
}
|
|
85
|
+
set headerPosition(value) {
|
|
86
|
+
var _a;
|
|
87
|
+
this._headerPosition = value;
|
|
88
|
+
removeClasses(this.container, 'dv-groupview-header-top', 'dv-groupview-header-bottom', 'dv-groupview-header-left', 'dv-groupview-header-right');
|
|
89
|
+
addClasses(this.container, `dv-groupview-header-${value}`);
|
|
90
|
+
const direction = value === 'top' || value === 'bottom' ? 'horizontal' : 'vertical';
|
|
91
|
+
this.tabsContainer.direction = direction;
|
|
92
|
+
this.header.direction = direction;
|
|
93
|
+
// resize the active panel to fit the new header direction
|
|
94
|
+
// if not, the panel will overflow the tabs container
|
|
95
|
+
if ((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.layout) {
|
|
96
|
+
this._activePanel.layout(this._width, this._height);
|
|
97
|
+
}
|
|
98
|
+
if (this._leftHeaderActions ||
|
|
99
|
+
this._rightHeaderActions ||
|
|
100
|
+
this._prefixHeaderActions) {
|
|
101
|
+
this.updateHeaderActions();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
81
104
|
get location() {
|
|
82
105
|
return this._location;
|
|
83
106
|
}
|
|
@@ -112,7 +135,7 @@ export class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
112
135
|
});
|
|
113
136
|
}
|
|
114
137
|
constructor(container, accessor, id, options, groupPanel) {
|
|
115
|
-
var _a;
|
|
138
|
+
var _a, _b;
|
|
116
139
|
super();
|
|
117
140
|
this.container = container;
|
|
118
141
|
this.accessor = accessor;
|
|
@@ -121,6 +144,9 @@ export class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
121
144
|
this.groupPanel = groupPanel;
|
|
122
145
|
this._isGroupActive = false;
|
|
123
146
|
this._locked = false;
|
|
147
|
+
this._rightHeaderActionsDisposable = new MutableDisposable();
|
|
148
|
+
this._leftHeaderActionsDisposable = new MutableDisposable();
|
|
149
|
+
this._prefixHeaderActionsDisposable = new MutableDisposable();
|
|
124
150
|
this._location = { type: 'grid' };
|
|
125
151
|
this.mostRecentlyUsed = [];
|
|
126
152
|
this._overwriteRenderContainer = null;
|
|
@@ -162,7 +188,9 @@ export class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
162
188
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
163
189
|
this.header.hidden = !!options.hideHeader;
|
|
164
190
|
this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
|
|
165
|
-
this.
|
|
191
|
+
this.headerPosition =
|
|
192
|
+
(_b = options.headerPosition) !== null && _b !== void 0 ? _b : accessor.defaultHeaderPosition;
|
|
193
|
+
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this._rightHeaderActionsDisposable, this._leftHeaderActionsDisposable, this._prefixHeaderActionsDisposable, this.tabsContainer.onTabDragStart((event) => {
|
|
166
194
|
this._onTabDragStart.fire(event);
|
|
167
195
|
}), this.tabsContainer.onGroupDragStart((event) => {
|
|
168
196
|
this._onGroupDragStart.fire(event);
|
|
@@ -222,10 +250,13 @@ export class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
222
250
|
// correctly initialized
|
|
223
251
|
this.setActive(this.isActive, true);
|
|
224
252
|
this.updateContainer();
|
|
253
|
+
this.updateHeaderActions();
|
|
254
|
+
}
|
|
255
|
+
updateHeaderActions() {
|
|
225
256
|
if (this.accessor.options.createRightHeaderActionComponent) {
|
|
226
257
|
this._rightHeaderActions =
|
|
227
258
|
this.accessor.options.createRightHeaderActionComponent(this.groupPanel);
|
|
228
|
-
this.
|
|
259
|
+
this._rightHeaderActionsDisposable.value = this._rightHeaderActions;
|
|
229
260
|
this._rightHeaderActions.init({
|
|
230
261
|
containerApi: this._api,
|
|
231
262
|
api: this.groupPanel.api,
|
|
@@ -233,10 +264,15 @@ export class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
233
264
|
});
|
|
234
265
|
this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
|
|
235
266
|
}
|
|
267
|
+
else {
|
|
268
|
+
this._rightHeaderActions = undefined;
|
|
269
|
+
this._rightHeaderActionsDisposable.dispose();
|
|
270
|
+
this.tabsContainer.setRightActionsElement(undefined);
|
|
271
|
+
}
|
|
236
272
|
if (this.accessor.options.createLeftHeaderActionComponent) {
|
|
237
273
|
this._leftHeaderActions =
|
|
238
274
|
this.accessor.options.createLeftHeaderActionComponent(this.groupPanel);
|
|
239
|
-
this.
|
|
275
|
+
this._leftHeaderActionsDisposable.value = this._leftHeaderActions;
|
|
240
276
|
this._leftHeaderActions.init({
|
|
241
277
|
containerApi: this._api,
|
|
242
278
|
api: this.groupPanel.api,
|
|
@@ -244,10 +280,16 @@ export class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
244
280
|
});
|
|
245
281
|
this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
|
|
246
282
|
}
|
|
283
|
+
else {
|
|
284
|
+
this._leftHeaderActions = undefined;
|
|
285
|
+
this._leftHeaderActionsDisposable.dispose();
|
|
286
|
+
this.tabsContainer.setLeftActionsElement(undefined);
|
|
287
|
+
}
|
|
247
288
|
if (this.accessor.options.createPrefixHeaderActionComponent) {
|
|
248
289
|
this._prefixHeaderActions =
|
|
249
290
|
this.accessor.options.createPrefixHeaderActionComponent(this.groupPanel);
|
|
250
|
-
this.
|
|
291
|
+
this._prefixHeaderActionsDisposable.value =
|
|
292
|
+
this._prefixHeaderActions;
|
|
251
293
|
this._prefixHeaderActions.init({
|
|
252
294
|
containerApi: this._api,
|
|
253
295
|
api: this.groupPanel.api,
|
|
@@ -255,6 +297,11 @@ export class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
255
297
|
});
|
|
256
298
|
this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
|
|
257
299
|
}
|
|
300
|
+
else {
|
|
301
|
+
this._prefixHeaderActions = undefined;
|
|
302
|
+
this._prefixHeaderActionsDisposable.dispose();
|
|
303
|
+
this.tabsContainer.setPrefixActionsElement(undefined);
|
|
304
|
+
}
|
|
258
305
|
}
|
|
259
306
|
rerender(panel) {
|
|
260
307
|
this.contentContainer.renderPanel(panel, { asActive: false });
|
|
@@ -275,6 +322,9 @@ export class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
275
322
|
if (this.header.hidden) {
|
|
276
323
|
result.hideHeader = true;
|
|
277
324
|
}
|
|
325
|
+
if (this.headerPosition !== 'top') {
|
|
326
|
+
result.headerPosition = this.headerPosition;
|
|
327
|
+
}
|
|
278
328
|
return result;
|
|
279
329
|
}
|
|
280
330
|
moveToNext(options) {
|
|
@@ -472,6 +522,9 @@ export class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
472
522
|
if (!options.skipSetActive) {
|
|
473
523
|
this.contentContainer.openPanel(panel);
|
|
474
524
|
}
|
|
525
|
+
else if (panel.api.renderer === 'always') {
|
|
526
|
+
this.contentContainer.renderPanel(panel, { asActive: false });
|
|
527
|
+
}
|
|
475
528
|
if (hasExistingPanel) {
|
|
476
529
|
// TODO - need to ensure ordering hasn't changed and if it has need to re-order this.panels
|
|
477
530
|
return;
|
|
@@ -4,6 +4,7 @@ import { DockviewPanelApi } from '../api/dockviewPanelApi';
|
|
|
4
4
|
import { PanelParameters } from '../framwork';
|
|
5
5
|
import { DockviewGroupPanel, IDockviewGroupPanel } from './dockviewGroupPanel';
|
|
6
6
|
import { IDockviewPanel } from './dockviewPanel';
|
|
7
|
+
import { DockviewHeaderPosition } from './options';
|
|
7
8
|
export interface IGroupPanelBaseProps<T extends {
|
|
8
9
|
[index: string]: any;
|
|
9
10
|
} = any> extends PanelParameters<T> {
|
|
@@ -26,6 +27,7 @@ export interface IDockviewHeaderActionsProps {
|
|
|
26
27
|
activePanel: IDockviewPanel | undefined;
|
|
27
28
|
isGroupActive: boolean;
|
|
28
29
|
group: DockviewGroupPanel;
|
|
30
|
+
headerPosition: DockviewHeaderPosition;
|
|
29
31
|
}
|
|
30
32
|
export interface IGroupHeaderProps {
|
|
31
33
|
api: DockviewGroupPanelApi;
|
|
@@ -29,6 +29,8 @@ export interface ViewFactoryData {
|
|
|
29
29
|
content: string;
|
|
30
30
|
tab?: string;
|
|
31
31
|
}
|
|
32
|
+
export type DockviewHeaderPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
33
|
+
export type DockviewHeaderDirection = 'horizontal' | 'vertical';
|
|
32
34
|
export interface DockviewOptions {
|
|
33
35
|
/**
|
|
34
36
|
* Disable the auto-resizing which is controlled through a `ResizeObserver`.
|
|
@@ -44,6 +46,7 @@ export interface DockviewOptions {
|
|
|
44
46
|
};
|
|
45
47
|
popoutUrl?: string;
|
|
46
48
|
defaultRenderer?: DockviewPanelRenderer;
|
|
49
|
+
defaultHeaderPosition?: DockviewHeaderPosition;
|
|
47
50
|
debug?: boolean;
|
|
48
51
|
dndEdges?: false | DroptargetOverlayModel;
|
|
49
52
|
/**
|