dockview-core 4.13.0 → 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 +4 -1
- package/dist/cjs/dockview/dockviewComponent.js +93 -58
- 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 +284 -77
- 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 +283 -76
- 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 +4 -1
- package/dist/esm/dockview/dockviewComponent.js +34 -14
- 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} +284 -77
- 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} +284 -77
- package/dist/styles/dockview.css +63 -7
- package/package.json +63 -53
- package/dist/dockview-core.amd.js +0 -11365
- 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 -11335
- 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
|
@@ -2,6 +2,7 @@ import { Position } from '../dnd/droptarget';
|
|
|
2
2
|
import { DockviewComponent } from '../dockview/dockviewComponent';
|
|
3
3
|
import { DockviewGroupPanel } from '../dockview/dockviewGroupPanel';
|
|
4
4
|
import { DockviewGroupChangeEvent, DockviewGroupLocation } from '../dockview/dockviewGroupPanelModel';
|
|
5
|
+
import { DockviewHeaderPosition } from '../dockview/options';
|
|
5
6
|
import { Emitter, Event } from '../events';
|
|
6
7
|
import { GridviewPanelApi, GridviewPanelApiImpl, SizeEvent } from './gridviewPanelApi';
|
|
7
8
|
export interface DockviewGroupMoveParams {
|
|
@@ -25,6 +26,8 @@ export interface DockviewGroupPanelApi extends GridviewPanelApi {
|
|
|
25
26
|
*/
|
|
26
27
|
getWindow(): Window;
|
|
27
28
|
moveTo(options: DockviewGroupMoveParams): void;
|
|
29
|
+
setHeaderPosition(position: DockviewHeaderPosition): void;
|
|
30
|
+
getHeaderPosition(): DockviewHeaderPosition;
|
|
28
31
|
maximize(): void;
|
|
29
32
|
isMaximized(): boolean;
|
|
30
33
|
exitMaximized(): void;
|
|
@@ -46,6 +49,8 @@ export declare class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
46
49
|
setSize(event: SizeEvent): void;
|
|
47
50
|
close(): void;
|
|
48
51
|
getWindow(): Window;
|
|
52
|
+
setHeaderPosition(position: DockviewHeaderPosition): void;
|
|
53
|
+
getHeaderPosition(): DockviewHeaderPosition;
|
|
49
54
|
moveTo(options: DockviewGroupMoveParams): void;
|
|
50
55
|
maximize(): void;
|
|
51
56
|
isMaximized(): boolean;
|
|
@@ -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
|
/**
|
|
@@ -292,6 +293,8 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
|
|
|
292
293
|
skipPopoutReturn?: boolean;
|
|
293
294
|
} | undefined): DockviewGroupPanel;
|
|
294
295
|
private _moving;
|
|
296
|
+
private _updatePositionsFrameId;
|
|
297
|
+
private debouncedUpdateAllPositions;
|
|
295
298
|
movingLock<T>(func: () => T): T;
|
|
296
299
|
moveGroupOrPanel(options: MoveGroupOrPanelOptions): void;
|
|
297
300
|
moveGroup(options: MoveGroupOptions): void;
|
|
@@ -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
|
}
|
|
@@ -184,7 +188,14 @@ export class DockviewComponent extends BaseGrid {
|
|
|
184
188
|
if (options.debug) {
|
|
185
189
|
this.addDisposables(new StrictEventsSequencing(this));
|
|
186
190
|
}
|
|
187
|
-
this.addDisposables(this.rootDropTargetContainer, this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this.
|
|
191
|
+
this.addDisposables(this.rootDropTargetContainer, this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidMovePanel.event(() => {
|
|
192
|
+
/**
|
|
193
|
+
* Update overlay positions after DOM layout completes to prevent 0×0 dimensions.
|
|
194
|
+
* With defaultRenderer="always" this results in panel content not showing after move operations.
|
|
195
|
+
* Debounced to avoid multiple calls when moving groups with multiple panels.
|
|
196
|
+
*/
|
|
197
|
+
this.debouncedUpdateAllPositions();
|
|
198
|
+
}), this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this._onDidMaximizedGroupChange, this._onDidOptionsChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, this._onDidOpenPopoutWindowFail, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
|
|
188
199
|
this.updateWatermark();
|
|
189
200
|
}), this.onDidAdd((event) => {
|
|
190
201
|
if (!this._moving) {
|
|
@@ -630,9 +641,9 @@ export class DockviewComponent extends BaseGrid {
|
|
|
630
641
|
const anchoredBox = getAnchoredBox();
|
|
631
642
|
const overlay = new Overlay(Object.assign(Object.assign({ container: this.gridview.element, content: group.element }, anchoredBox), { minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
632
643
|
? undefined
|
|
633
|
-
: (_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'
|
|
634
645
|
? undefined
|
|
635
|
-
: (_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) }));
|
|
636
647
|
const el = group.element.querySelector('.dv-void-container');
|
|
637
648
|
if (!el) {
|
|
638
649
|
throw new Error('dockview: failed to find drag handle');
|
|
@@ -747,6 +758,13 @@ export class DockviewComponent extends BaseGrid {
|
|
|
747
758
|
if ('theme' in options) {
|
|
748
759
|
this.updateTheme();
|
|
749
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
|
+
}
|
|
750
768
|
this.layout(this.gridview.width, this.gridview.height, true);
|
|
751
769
|
}
|
|
752
770
|
layout(width, height, forceResize) {
|
|
@@ -903,7 +921,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
903
921
|
const width = this.width;
|
|
904
922
|
const height = this.height;
|
|
905
923
|
const createGroupFromSerializedState = (data) => {
|
|
906
|
-
const { id, locked, hideHeader, views, activeView } = data;
|
|
924
|
+
const { id, locked, hideHeader, headerPosition, views, activeView, } = data;
|
|
907
925
|
if (typeof id !== 'string') {
|
|
908
926
|
throw new Error('dockview: group id must be of type string');
|
|
909
927
|
}
|
|
@@ -911,6 +929,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
911
929
|
id,
|
|
912
930
|
locked: !!locked,
|
|
913
931
|
hideHeader: !!hideHeader,
|
|
932
|
+
headerPosition,
|
|
914
933
|
});
|
|
915
934
|
this._onDidAddGroup.fire(group);
|
|
916
935
|
const createdPanels = [];
|
|
@@ -1052,9 +1071,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1052
1071
|
}
|
|
1053
1072
|
this.updateWatermark();
|
|
1054
1073
|
// Force position updates for always visible panels after DOM layout is complete
|
|
1055
|
-
|
|
1056
|
-
this.overlayRenderContainer.updateAllPositions();
|
|
1057
|
-
});
|
|
1074
|
+
this.debouncedUpdateAllPositions();
|
|
1058
1075
|
this._onDidLayoutFromJSON.fire();
|
|
1059
1076
|
}
|
|
1060
1077
|
clear() {
|
|
@@ -1390,6 +1407,15 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1390
1407
|
}
|
|
1391
1408
|
return re;
|
|
1392
1409
|
}
|
|
1410
|
+
debouncedUpdateAllPositions() {
|
|
1411
|
+
if (this._updatePositionsFrameId !== undefined) {
|
|
1412
|
+
cancelAnimationFrame(this._updatePositionsFrameId);
|
|
1413
|
+
}
|
|
1414
|
+
this._updatePositionsFrameId = requestAnimationFrame(() => {
|
|
1415
|
+
this._updatePositionsFrameId = undefined;
|
|
1416
|
+
this.overlayRenderContainer.updateAllPositions();
|
|
1417
|
+
});
|
|
1418
|
+
}
|
|
1393
1419
|
movingLock(func) {
|
|
1394
1420
|
const isMoving = this._moving;
|
|
1395
1421
|
try {
|
|
@@ -1460,13 +1486,6 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1460
1486
|
panel: removedPanel,
|
|
1461
1487
|
from: sourceGroup,
|
|
1462
1488
|
});
|
|
1463
|
-
/**
|
|
1464
|
-
* Update overlay positions after DOM layout completes to prevent 0×0 dimensions.
|
|
1465
|
-
* With defaultRenderer="always" this results in panel content not showing after move operations.
|
|
1466
|
-
*/
|
|
1467
|
-
requestAnimationFrame(() => {
|
|
1468
|
-
this.overlayRenderContainer.updateAllPositions();
|
|
1469
|
-
});
|
|
1470
1489
|
}
|
|
1471
1490
|
else {
|
|
1472
1491
|
/**
|
|
@@ -1707,6 +1726,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1707
1726
|
from.panels.forEach((panel) => {
|
|
1708
1727
|
this._onDidMovePanel.fire({ panel, from });
|
|
1709
1728
|
});
|
|
1729
|
+
this.debouncedUpdateAllPositions();
|
|
1710
1730
|
// Ensure group becomes active after move
|
|
1711
1731
|
if (options.skipSetActive === false) {
|
|
1712
1732
|
// Only activate when explicitly requested (skipSetActive: false)
|
|
@@ -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;
|