dockview-core 1.12.0 → 1.13.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/dist/cjs/api/component.api.d.ts +2 -1
- package/dist/cjs/api/component.api.js +7 -0
- package/dist/cjs/api/dockviewGroupPanelApi.d.ts +5 -1
- package/dist/cjs/api/dockviewGroupPanelApi.js +19 -1
- package/dist/cjs/dnd/droptarget.d.ts +1 -1
- package/dist/cjs/dnd/droptarget.js +4 -10
- package/dist/cjs/dockview/components/panel/content.js +0 -8
- package/dist/cjs/dockview/dockviewComponent.d.ts +6 -4
- package/dist/cjs/dockview/dockviewComponent.js +71 -67
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +3 -0
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +18 -19
- package/dist/cjs/dockview/dockviewPanelModel.js +21 -24
- package/dist/cjs/dockview/framework.d.ts +38 -0
- package/dist/cjs/dockview/framework.js +2 -0
- package/dist/cjs/dockview/options.d.ts +68 -46
- package/dist/cjs/dockview/options.js +43 -1
- package/dist/cjs/dockview/types.d.ts +4 -10
- package/dist/cjs/framwork.d.ts +4 -0
- package/dist/cjs/framwork.js +2 -0
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +1 -1
- package/dist/dockview-core.amd.js +1973 -1920
- 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 +1973 -1920
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +1973 -1920
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +1972 -1921
- 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 +1973 -1920
- 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 +1973 -1920
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/api/component.api.d.ts +2 -1
- package/dist/esm/api/component.api.js +3 -0
- package/dist/esm/api/dockviewGroupPanelApi.d.ts +5 -1
- package/dist/esm/api/dockviewGroupPanelApi.js +18 -1
- package/dist/esm/dnd/droptarget.d.ts +1 -1
- package/dist/esm/dnd/droptarget.js +4 -10
- package/dist/esm/dockview/components/panel/content.js +0 -8
- package/dist/esm/dockview/dockviewComponent.d.ts +6 -4
- package/dist/esm/dockview/dockviewComponent.js +70 -68
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +3 -0
- package/dist/esm/dockview/dockviewGroupPanelModel.js +18 -19
- package/dist/esm/dockview/dockviewPanelModel.js +21 -13
- package/dist/esm/dockview/framework.d.ts +38 -0
- package/dist/esm/dockview/framework.js +1 -0
- package/dist/esm/dockview/options.d.ts +68 -46
- package/dist/esm/dockview/options.js +36 -0
- package/dist/esm/dockview/types.d.ts +4 -10
- package/dist/esm/framwork.d.ts +4 -0
- package/dist/esm/framwork.js +1 -0
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IDockviewComponent, SerializedDockview } from '../dockview/dockviewComponent';
|
|
2
|
-
import { AddGroupOptions, AddPanelOptions, MovementOptions } from '../dockview/options';
|
|
2
|
+
import { AddGroupOptions, AddPanelOptions, DockviewDndOverlayEvent, MovementOptions } from '../dockview/options';
|
|
3
3
|
import { Parameters } from '../panel/types';
|
|
4
4
|
import { Direction } from '../gridview/baseComponentGridview';
|
|
5
5
|
import { AddComponentOptions, IGridviewComponent, SerializedGridviewComponent } from '../gridview/gridviewComponent';
|
|
@@ -393,6 +393,7 @@ export declare class DockviewApi implements CommonApi<SerializedDockview> {
|
|
|
393
393
|
* Calling `event.nativeEvent.preventDefault()` will prevent the panel drag starting.
|
|
394
394
|
*/
|
|
395
395
|
get onWillDragPanel(): Event<TabDragEvent>;
|
|
396
|
+
get onUnhandledDragOverEvent(): Event<DockviewDndOverlayEvent>;
|
|
396
397
|
/**
|
|
397
398
|
* All panel objects.
|
|
398
399
|
*/
|
|
@@ -790,6 +790,13 @@ var DockviewApi = /** @class */ (function () {
|
|
|
790
790
|
enumerable: false,
|
|
791
791
|
configurable: true
|
|
792
792
|
});
|
|
793
|
+
Object.defineProperty(DockviewApi.prototype, "onUnhandledDragOverEvent", {
|
|
794
|
+
get: function () {
|
|
795
|
+
return this.component.onUnhandledDragOverEvent;
|
|
796
|
+
},
|
|
797
|
+
enumerable: false,
|
|
798
|
+
configurable: true
|
|
799
|
+
});
|
|
793
800
|
Object.defineProperty(DockviewApi.prototype, "panels", {
|
|
794
801
|
/**
|
|
795
802
|
* All panel objects.
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Position } from '../dnd/droptarget';
|
|
2
2
|
import { DockviewComponent } from '../dockview/dockviewComponent';
|
|
3
3
|
import { DockviewGroupPanel } from '../dockview/dockviewGroupPanel';
|
|
4
|
-
import { DockviewGroupLocation } from '../dockview/dockviewGroupPanelModel';
|
|
4
|
+
import { DockviewGroupChangeEvent, DockviewGroupLocation } from '../dockview/dockviewGroupPanelModel';
|
|
5
5
|
import { Emitter, Event } from '../events';
|
|
6
6
|
import { GridviewPanelApi, GridviewPanelApiImpl } from './gridviewPanelApi';
|
|
7
7
|
export interface DockviewGroupPanelApi extends GridviewPanelApi {
|
|
8
8
|
readonly onDidLocationChange: Event<DockviewGroupPanelFloatingChangeEvent>;
|
|
9
|
+
readonly onDidActivePanelChange: Event<DockviewGroupChangeEvent>;
|
|
9
10
|
readonly location: DockviewGroupLocation;
|
|
10
11
|
/**
|
|
11
12
|
* If you require the Window object
|
|
@@ -25,9 +26,12 @@ export interface DockviewGroupPanelFloatingChangeEvent {
|
|
|
25
26
|
}
|
|
26
27
|
export declare class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
27
28
|
private readonly accessor;
|
|
29
|
+
private readonly _mutableDisposable;
|
|
28
30
|
private _group;
|
|
29
31
|
readonly _onDidLocationChange: Emitter<DockviewGroupPanelFloatingChangeEvent>;
|
|
30
32
|
readonly onDidLocationChange: Event<DockviewGroupPanelFloatingChangeEvent>;
|
|
33
|
+
private readonly _onDidActivePanelChange;
|
|
34
|
+
readonly onDidActivePanelChange: Event<DockviewGroupChangeEvent>;
|
|
31
35
|
get location(): DockviewGroupLocation;
|
|
32
36
|
constructor(id: string, accessor: DockviewComponent);
|
|
33
37
|
close(): void;
|
|
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.DockviewGroupPanelApiImpl = void 0;
|
|
19
19
|
var droptarget_1 = require("../dnd/droptarget");
|
|
20
20
|
var events_1 = require("../events");
|
|
21
|
+
var lifecycle_1 = require("../lifecycle");
|
|
21
22
|
var gridviewPanelApi_1 = require("./gridviewPanelApi");
|
|
22
23
|
// TODO find a better way to initialize and avoid needing null checks
|
|
23
24
|
var NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
|
|
@@ -26,9 +27,12 @@ var DockviewGroupPanelApiImpl = /** @class */ (function (_super) {
|
|
|
26
27
|
function DockviewGroupPanelApiImpl(id, accessor) {
|
|
27
28
|
var _this = _super.call(this, id, '__dockviewgroup__') || this;
|
|
28
29
|
_this.accessor = accessor;
|
|
30
|
+
_this._mutableDisposable = new lifecycle_1.MutableDisposable();
|
|
29
31
|
_this._onDidLocationChange = new events_1.Emitter();
|
|
30
32
|
_this.onDidLocationChange = _this._onDidLocationChange.event;
|
|
31
|
-
_this.
|
|
33
|
+
_this._onDidActivePanelChange = new events_1.Emitter();
|
|
34
|
+
_this.onDidActivePanelChange = _this._onDidActivePanelChange.event;
|
|
35
|
+
_this.addDisposables(_this._onDidLocationChange, _this._onDidActivePanelChange, _this._mutableDisposable);
|
|
32
36
|
return _this;
|
|
33
37
|
}
|
|
34
38
|
Object.defineProperty(DockviewGroupPanelApiImpl.prototype, "location", {
|
|
@@ -96,7 +100,21 @@ var DockviewGroupPanelApiImpl = /** @class */ (function (_super) {
|
|
|
96
100
|
}
|
|
97
101
|
};
|
|
98
102
|
DockviewGroupPanelApiImpl.prototype.initialize = function (group) {
|
|
103
|
+
var _this = this;
|
|
99
104
|
this._group = group;
|
|
105
|
+
/**
|
|
106
|
+
* TODO: Annoying initialization order caveat
|
|
107
|
+
*
|
|
108
|
+
* Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
|
|
109
|
+
* By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
|
|
110
|
+
* finished ensuring the `model` is defined.
|
|
111
|
+
*/
|
|
112
|
+
queueMicrotask(function () {
|
|
113
|
+
_this._mutableDisposable.value =
|
|
114
|
+
_this._group.model.onDidActivePanelChange(function (event) {
|
|
115
|
+
_this._onDidActivePanelChange.fire(event);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
100
118
|
};
|
|
101
119
|
return DockviewGroupPanelApiImpl;
|
|
102
120
|
}(gridviewPanelApi_1.GridviewPanelApiImpl));
|
|
@@ -18,7 +18,7 @@ export declare class WillShowOverlayEvent extends DockviewEvent implements Dropt
|
|
|
18
18
|
export declare function directionToPosition(direction: Direction): Position;
|
|
19
19
|
export declare function positionToDirection(position: Position): Direction;
|
|
20
20
|
export type Position = 'top' | 'bottom' | 'left' | 'right' | 'center';
|
|
21
|
-
export type CanDisplayOverlay =
|
|
21
|
+
export type CanDisplayOverlay = (dragEvent: DragEvent, state: Position) => boolean;
|
|
22
22
|
export type MeasuredValue = {
|
|
23
23
|
value: number;
|
|
24
24
|
type: 'pixels' | 'percentage';
|
|
@@ -127,6 +127,10 @@ var Droptarget = /** @class */ (function (_super) {
|
|
|
127
127
|
_this.removeDropTarget();
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
|
+
if (!_this.options.canDisplayOverlay(e, quadrant)) {
|
|
131
|
+
_this.removeDropTarget();
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
130
134
|
var willShowOverlayEvent = new WillShowOverlayEvent({
|
|
131
135
|
nativeEvent: e,
|
|
132
136
|
position: quadrant,
|
|
@@ -140,16 +144,6 @@ var Droptarget = /** @class */ (function (_super) {
|
|
|
140
144
|
_this.removeDropTarget();
|
|
141
145
|
return;
|
|
142
146
|
}
|
|
143
|
-
if (typeof _this.options.canDisplayOverlay === 'boolean') {
|
|
144
|
-
if (!_this.options.canDisplayOverlay) {
|
|
145
|
-
_this.removeDropTarget();
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
else if (!_this.options.canDisplayOverlay(e, quadrant)) {
|
|
150
|
-
_this.removeDropTarget();
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
147
|
_this.markAsUsed(e);
|
|
154
148
|
if (!_this.targetElement) {
|
|
155
149
|
_this.targetElement = document.createElement('div');
|
|
@@ -118,17 +118,9 @@ var ContentContainer = /** @class */ (function (_super) {
|
|
|
118
118
|
break;
|
|
119
119
|
}
|
|
120
120
|
if (doRender) {
|
|
121
|
-
var _onDidFocus = panel.view.content.onDidFocus;
|
|
122
|
-
var _onDidBlur = panel.view.content.onDidBlur;
|
|
123
121
|
var focusTracker = (0, dom_1.trackFocus)(container);
|
|
124
122
|
var disposable = new lifecycle_1.CompositeDisposable();
|
|
125
123
|
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(function () { return _this._onDidFocus.fire(); }), focusTracker.onDidBlur(function () { return _this._onDidBlur.fire(); }));
|
|
126
|
-
if (_onDidFocus) {
|
|
127
|
-
disposable.addDisposables(_onDidFocus(function () { return _this._onDidFocus.fire(); }));
|
|
128
|
-
}
|
|
129
|
-
if (_onDidBlur) {
|
|
130
|
-
disposable.addDisposables(_onDidBlur(function () { return _this._onDidBlur.fire(); }));
|
|
131
|
-
}
|
|
132
124
|
this.disposable.value = disposable;
|
|
133
125
|
}
|
|
134
126
|
};
|
|
@@ -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, MovementOptions } from './options';
|
|
6
|
+
import { AddGroupOptions, AddPanelOptions, DockviewComponentOptions, DockviewDndOverlayEvent, DockviewOptions, MovementOptions } 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';
|
|
@@ -42,7 +42,6 @@ export interface SerializedDockview {
|
|
|
42
42
|
floatingGroups?: SerializedFloatingGroup[];
|
|
43
43
|
popoutGroups?: SerializedPopoutGroup[];
|
|
44
44
|
}
|
|
45
|
-
export type DockviewComponentUpdateOptions = Pick<DockviewComponentOptions, 'orientation' | 'components' | 'frameworkComponents' | 'tabComponents' | 'frameworkTabComponents' | 'showDndOverlay' | 'watermarkFrameworkComponent' | 'defaultTabComponent' | 'createLeftHeaderActionsElement' | 'createRightHeaderActionsElement' | 'createPrefixHeaderActionsElement' | 'disableFloatingGroups' | 'floatingGroupBounds' | 'rootOverlayModel' | 'disableDnd'>;
|
|
46
45
|
type MoveGroupOptions = {
|
|
47
46
|
from: {
|
|
48
47
|
group: DockviewGroupPanel;
|
|
@@ -80,8 +79,9 @@ export interface IDockviewComponent extends IBaseGrid<DockviewGroupPanel> {
|
|
|
80
79
|
readonly onDidRemoveGroup: Event<DockviewGroupPanel>;
|
|
81
80
|
readonly onDidAddGroup: Event<DockviewGroupPanel>;
|
|
82
81
|
readonly onDidActiveGroupChange: Event<DockviewGroupPanel | undefined>;
|
|
82
|
+
readonly onUnhandledDragOverEvent: Event<DockviewDndOverlayEvent>;
|
|
83
83
|
readonly options: DockviewComponentOptions;
|
|
84
|
-
updateOptions(options:
|
|
84
|
+
updateOptions(options: DockviewOptions): void;
|
|
85
85
|
moveGroupOrPanel(options: MoveGroupOrPanelOptions): void;
|
|
86
86
|
moveGroup(options: MoveGroupOptions): void;
|
|
87
87
|
doSetGroupActive: (group: DockviewGroupPanel, skipFocus?: boolean) => void;
|
|
@@ -132,6 +132,8 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
|
|
|
132
132
|
readonly onWillDrop: Event<DockviewWillDropEvent>;
|
|
133
133
|
private readonly _onWillShowOverlay;
|
|
134
134
|
readonly onWillShowOverlay: Event<WillShowOverlayLocationEvent>;
|
|
135
|
+
private readonly _onUnhandledDragOverEvent;
|
|
136
|
+
readonly onUnhandledDragOverEvent: Event<DockviewDndOverlayEvent>;
|
|
135
137
|
private readonly _onDidRemovePanel;
|
|
136
138
|
readonly onDidRemovePanel: Event<IDockviewPanel>;
|
|
137
139
|
private readonly _onDidAddPanel;
|
|
@@ -184,7 +186,7 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
|
|
|
184
186
|
skipActiveGroup?: boolean;
|
|
185
187
|
}): void;
|
|
186
188
|
private orthogonalize;
|
|
187
|
-
updateOptions(options:
|
|
189
|
+
updateOptions(options: Partial<DockviewComponentOptions>): void;
|
|
188
190
|
layout(width: number, height: number, forceResize?: boolean | undefined): void;
|
|
189
191
|
focus(): void;
|
|
190
192
|
getGroupPanel(id: string): IDockviewPanel | undefined;
|
|
@@ -72,7 +72,6 @@ var events_1 = require("../events");
|
|
|
72
72
|
var watermark_1 = require("./components/watermark/watermark");
|
|
73
73
|
var math_1 = require("../math");
|
|
74
74
|
var deserializer_1 = require("./deserializer");
|
|
75
|
-
var componentFactory_1 = require("../panel/componentFactory");
|
|
76
75
|
var options_1 = require("./options");
|
|
77
76
|
var baseComponentGridview_1 = require("../gridview/baseComponentGridview");
|
|
78
77
|
var component_api_1 = require("../api/component.api");
|
|
@@ -189,11 +188,13 @@ function typeValidate(data) {
|
|
|
189
188
|
var DockviewComponent = /** @class */ (function (_super) {
|
|
190
189
|
__extends(DockviewComponent, _super);
|
|
191
190
|
function DockviewComponent(options) {
|
|
192
|
-
var _a
|
|
191
|
+
var _a;
|
|
193
192
|
var _this = _super.call(this, {
|
|
194
193
|
proportionalLayout: true,
|
|
195
|
-
orientation:
|
|
196
|
-
styles: options.
|
|
194
|
+
orientation: splitview_1.Orientation.HORIZONTAL,
|
|
195
|
+
styles: options.hideBorders
|
|
196
|
+
? { separatorBorder: 'transparent' }
|
|
197
|
+
: undefined,
|
|
197
198
|
parentElement: options.parentElement,
|
|
198
199
|
disableAutoResizing: options.disableAutoResizing,
|
|
199
200
|
locked: options.locked,
|
|
@@ -211,6 +212,8 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
211
212
|
_this.onWillDrop = _this._onWillDrop.event;
|
|
212
213
|
_this._onWillShowOverlay = new events_1.Emitter();
|
|
213
214
|
_this.onWillShowOverlay = _this._onWillShowOverlay.event;
|
|
215
|
+
_this._onUnhandledDragOverEvent = new events_1.Emitter();
|
|
216
|
+
_this.onUnhandledDragOverEvent = _this._onUnhandledDragOverEvent.event;
|
|
214
217
|
_this._onDidRemovePanel = new events_1.Emitter();
|
|
215
218
|
_this.onDidRemovePanel = _this._onDidRemovePanel.event;
|
|
216
219
|
_this._onDidAddPanel = new events_1.Emitter();
|
|
@@ -236,7 +239,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
236
239
|
_this.overlayRenderContainer = new overlayRenderContainer_1.OverlayRenderContainer(gready);
|
|
237
240
|
(0, dom_1.toggleClass)(_this.gridview.element, 'dv-dockview', true);
|
|
238
241
|
(0, dom_1.toggleClass)(_this.element, 'dv-debug', !!options.debug);
|
|
239
|
-
_this.addDisposables(_this.overlayRenderContainer, _this._onWillDragPanel, _this._onWillDragGroup, _this._onWillShowOverlay, _this._onDidActivePanelChange, _this._onDidAddPanel, _this._onDidRemovePanel, _this._onDidLayoutFromJSON, _this._onDidDrop, _this._onWillDrop, _this._onDidMovePanel, _this._onDidAddGroup, _this._onDidRemoveGroup, _this._onDidActiveGroupChange, _this.onDidAdd(function (event) {
|
|
242
|
+
_this.addDisposables(_this.overlayRenderContainer, _this._onWillDragPanel, _this._onWillDragGroup, _this._onWillShowOverlay, _this._onDidActivePanelChange, _this._onDidAddPanel, _this._onDidRemovePanel, _this._onDidLayoutFromJSON, _this._onDidDrop, _this._onWillDrop, _this._onDidMovePanel, _this._onDidAddGroup, _this._onDidRemoveGroup, _this._onDidActiveGroupChange, _this._onUnhandledDragOverEvent, _this.onDidAdd(function (event) {
|
|
240
243
|
if (!_this._moving) {
|
|
241
244
|
_this._onDidAddGroup.fire(event);
|
|
242
245
|
}
|
|
@@ -284,22 +287,6 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
284
287
|
}
|
|
285
288
|
}));
|
|
286
289
|
_this._options = options;
|
|
287
|
-
if (!_this.options.components) {
|
|
288
|
-
_this.options.components = {};
|
|
289
|
-
}
|
|
290
|
-
if (!_this.options.frameworkComponents) {
|
|
291
|
-
_this.options.frameworkComponents = {};
|
|
292
|
-
}
|
|
293
|
-
if (!_this.options.frameworkTabComponents) {
|
|
294
|
-
_this.options.frameworkTabComponents = {};
|
|
295
|
-
}
|
|
296
|
-
if (!_this.options.tabComponents) {
|
|
297
|
-
_this.options.tabComponents = {};
|
|
298
|
-
}
|
|
299
|
-
if (!_this.options.watermarkComponent &&
|
|
300
|
-
!_this.options.watermarkFrameworkComponent) {
|
|
301
|
-
_this.options.watermarkComponent = watermark_1.Watermark;
|
|
302
|
-
}
|
|
303
290
|
_this._rootDropTarget = new droptarget_1.Droptarget(_this.element, {
|
|
304
291
|
canDisplayOverlay: function (event, position) {
|
|
305
292
|
var data = (0, dataTransfer_1.getPanelData)();
|
|
@@ -314,26 +301,20 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
314
301
|
}
|
|
315
302
|
return true;
|
|
316
303
|
}
|
|
317
|
-
if (_this.
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
return false;
|
|
325
|
-
}
|
|
326
|
-
return _this.options.showDndOverlay({
|
|
327
|
-
nativeEvent: event,
|
|
328
|
-
position: position,
|
|
329
|
-
target: 'edge',
|
|
330
|
-
getData: dataTransfer_1.getPanelData,
|
|
331
|
-
});
|
|
304
|
+
if (position === 'center' && _this.gridview.length !== 0) {
|
|
305
|
+
/**
|
|
306
|
+
* for external events only show the four-corner drag overlays, disable
|
|
307
|
+
* the center position so that external drag events can fall through to the group
|
|
308
|
+
* and panel drop target handlers
|
|
309
|
+
*/
|
|
310
|
+
return false;
|
|
332
311
|
}
|
|
333
|
-
|
|
312
|
+
var firedEvent = new options_1.DockviewUnhandledDragOverEvent(event, 'edge', position, dataTransfer_1.getPanelData);
|
|
313
|
+
_this._onUnhandledDragOverEvent.fire(firedEvent);
|
|
314
|
+
return firedEvent.isAccepted;
|
|
334
315
|
},
|
|
335
316
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
336
|
-
overlayModel: (
|
|
317
|
+
overlayModel: (_a = _this.options.rootOverlayModel) !== null && _a !== void 0 ? _a : DEFAULT_ROOT_OVERLAY_MODEL,
|
|
337
318
|
});
|
|
338
319
|
_this.addDisposables(_this._rootDropTarget, _this._rootDropTarget.onWillShowOverlay(function (event) {
|
|
339
320
|
if (_this.gridview.length > 0 && event.position === 'center') {
|
|
@@ -620,7 +601,9 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
620
601
|
skipSetActiveGroup: true,
|
|
621
602
|
});
|
|
622
603
|
});
|
|
623
|
-
|
|
604
|
+
this.movingLock(function () {
|
|
605
|
+
return group.model.openPanel(item, { skipSetGroupActive: true });
|
|
606
|
+
});
|
|
624
607
|
}
|
|
625
608
|
else {
|
|
626
609
|
group = item;
|
|
@@ -695,7 +678,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
695
678
|
// this is either a resize or a move
|
|
696
679
|
// to inform the panels .layout(...) the group with it's current size
|
|
697
680
|
// don't care about resize since the above watcher handles that
|
|
698
|
-
group.layout(group.
|
|
681
|
+
group.layout(group.width, group.height);
|
|
699
682
|
}), overlay.onDidChangeEnd(function () {
|
|
700
683
|
_this._bufferOnDidLayoutChange.fire();
|
|
701
684
|
}), group.onDidChange(function (event) {
|
|
@@ -753,16 +736,11 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
753
736
|
DockviewComponent.prototype.updateOptions = function (options) {
|
|
754
737
|
var e_3, _a;
|
|
755
738
|
var _b, _c;
|
|
756
|
-
var
|
|
757
|
-
this.gridview.orientation !== options.orientation;
|
|
758
|
-
var changed_floatingGroupBounds = options.floatingGroupBounds !== undefined &&
|
|
739
|
+
var changed_floatingGroupBounds = 'floatingGroupBounds' in options &&
|
|
759
740
|
options.floatingGroupBounds !== this.options.floatingGroupBounds;
|
|
760
|
-
var changed_rootOverlayOptions =
|
|
741
|
+
var changed_rootOverlayOptions = 'rootOverlayModel' in options &&
|
|
761
742
|
options.rootOverlayModel !== this.options.rootOverlayModel;
|
|
762
743
|
this._options = __assign(__assign({}, this.options), options);
|
|
763
|
-
if (changed_orientation) {
|
|
764
|
-
this.gridview.orientation = options.orientation;
|
|
765
|
-
}
|
|
766
744
|
if (changed_floatingGroupBounds) {
|
|
767
745
|
try {
|
|
768
746
|
for (var _d = __values(this._floatingGroups), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
@@ -1178,7 +1156,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1178
1156
|
? this.getGroupPanel(options.position.referencePanel)
|
|
1179
1157
|
: options.position.referencePanel;
|
|
1180
1158
|
if (!referencePanel) {
|
|
1181
|
-
throw new Error("referencePanel ".concat(options.position.referencePanel, " does not exist"));
|
|
1159
|
+
throw new Error("referencePanel '".concat(options.position.referencePanel, "' does not exist"));
|
|
1182
1160
|
}
|
|
1183
1161
|
referenceGroup = this.findGroup(referencePanel);
|
|
1184
1162
|
}
|
|
@@ -1188,14 +1166,19 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1188
1166
|
? (_a = this._groups.get(options.position.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
|
|
1189
1167
|
: options.position.referenceGroup;
|
|
1190
1168
|
if (!referenceGroup) {
|
|
1191
|
-
throw new Error("
|
|
1169
|
+
throw new Error("referenceGroup '".concat(options.position.referenceGroup, "' does not exist"));
|
|
1192
1170
|
}
|
|
1193
1171
|
}
|
|
1194
1172
|
else {
|
|
1195
1173
|
var group = this.orthogonalize((0, droptarget_1.directionToPosition)(options.position.direction));
|
|
1196
1174
|
var panel_1 = this.createPanel(options, group);
|
|
1197
|
-
group.model.openPanel(panel_1
|
|
1198
|
-
|
|
1175
|
+
group.model.openPanel(panel_1, {
|
|
1176
|
+
skipSetActive: options.inactive,
|
|
1177
|
+
skipSetGroupActive: options.inactive,
|
|
1178
|
+
});
|
|
1179
|
+
if (!options.inactive) {
|
|
1180
|
+
this.doSetGroupAndPanelActive(group);
|
|
1181
|
+
}
|
|
1199
1182
|
return panel_1;
|
|
1200
1183
|
}
|
|
1201
1184
|
}
|
|
@@ -1218,43 +1201,64 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1218
1201
|
skipActiveGroup: true,
|
|
1219
1202
|
});
|
|
1220
1203
|
panel = this.createPanel(options, group);
|
|
1221
|
-
group.model.openPanel(panel
|
|
1204
|
+
group.model.openPanel(panel, {
|
|
1205
|
+
skipSetActive: options.inactive,
|
|
1206
|
+
skipSetGroupActive: options.inactive,
|
|
1207
|
+
});
|
|
1222
1208
|
}
|
|
1223
1209
|
else if (referenceGroup.api.location.type === 'floating' ||
|
|
1224
1210
|
target === 'center') {
|
|
1225
1211
|
panel = this.createPanel(options, referenceGroup);
|
|
1226
|
-
referenceGroup.model.openPanel(panel
|
|
1227
|
-
|
|
1212
|
+
referenceGroup.model.openPanel(panel, {
|
|
1213
|
+
skipSetActive: options.inactive,
|
|
1214
|
+
skipSetGroupActive: options.inactive,
|
|
1215
|
+
});
|
|
1216
|
+
if (!options.inactive) {
|
|
1217
|
+
this.doSetGroupAndPanelActive(referenceGroup);
|
|
1218
|
+
}
|
|
1228
1219
|
}
|
|
1229
1220
|
else {
|
|
1230
1221
|
var location_1 = (0, gridview_1.getGridLocation)(referenceGroup.element);
|
|
1231
1222
|
var relativeLocation = (0, gridview_1.getRelativeLocation)(this.gridview.orientation, location_1, target);
|
|
1232
1223
|
var group = this.createGroupAtLocation(relativeLocation);
|
|
1233
1224
|
panel = this.createPanel(options, group);
|
|
1234
|
-
group.model.openPanel(panel
|
|
1235
|
-
|
|
1225
|
+
group.model.openPanel(panel, {
|
|
1226
|
+
skipSetActive: options.inactive,
|
|
1227
|
+
skipSetGroupActive: options.inactive,
|
|
1228
|
+
});
|
|
1229
|
+
if (!options.inactive) {
|
|
1230
|
+
this.doSetGroupAndPanelActive(group);
|
|
1231
|
+
}
|
|
1236
1232
|
}
|
|
1237
1233
|
}
|
|
1238
1234
|
else if (options.floating) {
|
|
1239
1235
|
var group = this.createGroup();
|
|
1240
1236
|
this._onDidAddGroup.fire(group);
|
|
1241
|
-
var
|
|
1237
|
+
var coordinates = typeof options.floating === 'object' &&
|
|
1242
1238
|
options.floating !== null
|
|
1243
1239
|
? options.floating
|
|
1244
1240
|
: {};
|
|
1245
|
-
this.addFloatingGroup(group,
|
|
1241
|
+
this.addFloatingGroup(group, coordinates, {
|
|
1246
1242
|
inDragMode: false,
|
|
1247
1243
|
skipRemoveGroup: true,
|
|
1248
1244
|
skipActiveGroup: true,
|
|
1249
1245
|
});
|
|
1250
1246
|
panel = this.createPanel(options, group);
|
|
1251
|
-
group.model.openPanel(panel
|
|
1247
|
+
group.model.openPanel(panel, {
|
|
1248
|
+
skipSetActive: options.inactive,
|
|
1249
|
+
skipSetGroupActive: options.inactive,
|
|
1250
|
+
});
|
|
1252
1251
|
}
|
|
1253
1252
|
else {
|
|
1254
1253
|
var group = this.createGroupAtLocation();
|
|
1255
1254
|
panel = this.createPanel(options, group);
|
|
1256
|
-
group.model.openPanel(panel
|
|
1257
|
-
|
|
1255
|
+
group.model.openPanel(panel, {
|
|
1256
|
+
skipSetActive: options.inactive,
|
|
1257
|
+
skipSetGroupActive: options.inactive,
|
|
1258
|
+
});
|
|
1259
|
+
if (!options.inactive) {
|
|
1260
|
+
this.doSetGroupAndPanelActive(group);
|
|
1261
|
+
}
|
|
1258
1262
|
}
|
|
1259
1263
|
return panel;
|
|
1260
1264
|
};
|
|
@@ -1279,12 +1283,10 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1279
1283
|
}
|
|
1280
1284
|
};
|
|
1281
1285
|
DockviewComponent.prototype.createWatermarkComponent = function () {
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
? { 'watermark-name': this.options.watermarkFrameworkComponent }
|
|
1287
|
-
: {}, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.watermark);
|
|
1286
|
+
if (this.options.createWatermarkComponent) {
|
|
1287
|
+
return this.options.createWatermarkComponent();
|
|
1288
|
+
}
|
|
1289
|
+
return new watermark_1.Watermark();
|
|
1288
1290
|
};
|
|
1289
1291
|
DockviewComponent.prototype.updateWatermark = function () {
|
|
1290
1292
|
var _a, _b;
|
|
@@ -1704,6 +1706,8 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1704
1706
|
return;
|
|
1705
1707
|
}
|
|
1706
1708
|
_this._onWillShowOverlay.fire(event);
|
|
1709
|
+
}), view.model.onUnhandledDragOverEvent(function (event) {
|
|
1710
|
+
_this._onUnhandledDragOverEvent.fire(event);
|
|
1707
1711
|
}), view.model.onDidAddPanel(function (event) {
|
|
1708
1712
|
if (_this._moving) {
|
|
1709
1713
|
return;
|
|
@@ -9,6 +9,7 @@ import { IPanel, PanelInitParameters, PanelUpdateEvent, Parameters } from '../pa
|
|
|
9
9
|
import { GroupDragEvent, TabDragEvent } from './components/titlebar/tabsContainer';
|
|
10
10
|
import { DockviewGroupPanel } from './dockviewGroupPanel';
|
|
11
11
|
import { IDockviewPanel } from './dockviewPanel';
|
|
12
|
+
import { DockviewDndOverlayEvent } from './options';
|
|
12
13
|
import { OverlayRenderContainer } from '../overlayRenderContainer';
|
|
13
14
|
import { TitleEvent } from '../api/dockviewPanelApi';
|
|
14
15
|
interface GroupMoveEvent {
|
|
@@ -181,6 +182,8 @@ export declare class DockviewGroupPanelModel extends CompositeDisposable impleme
|
|
|
181
182
|
readonly onDidRemovePanel: Event<DockviewGroupChangeEvent>;
|
|
182
183
|
private readonly _onDidActivePanelChange;
|
|
183
184
|
readonly onDidActivePanelChange: Event<DockviewGroupChangeEvent>;
|
|
185
|
+
private readonly _onUnhandledDragOverEvent;
|
|
186
|
+
readonly onUnhandledDragOverEvent: Event<DockviewDndOverlayEvent>;
|
|
184
187
|
private readonly _api;
|
|
185
188
|
get element(): HTMLElement;
|
|
186
189
|
get activePanel(): IDockviewPanel | undefined;
|
|
@@ -59,6 +59,7 @@ var events_1 = require("../events");
|
|
|
59
59
|
var lifecycle_1 = require("../lifecycle");
|
|
60
60
|
var content_1 = require("./components/panel/content");
|
|
61
61
|
var tabsContainer_1 = require("./components/titlebar/tabsContainer");
|
|
62
|
+
var options_1 = require("./options");
|
|
62
63
|
var DockviewDidDropEvent = /** @class */ (function (_super) {
|
|
63
64
|
__extends(DockviewDidDropEvent, _super);
|
|
64
65
|
function DockviewDidDropEvent(options) {
|
|
@@ -229,6 +230,8 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
229
230
|
_this.onDidRemovePanel = _this._onDidRemovePanel.event;
|
|
230
231
|
_this._onDidActivePanelChange = new events_1.Emitter();
|
|
231
232
|
_this.onDidActivePanelChange = _this._onDidActivePanelChange.event;
|
|
233
|
+
_this._onUnhandledDragOverEvent = new events_1.Emitter();
|
|
234
|
+
_this.onUnhandledDragOverEvent = _this._onUnhandledDragOverEvent.event;
|
|
232
235
|
_this._overwriteRenderContainer = null;
|
|
233
236
|
(0, dom_1.toggleClass)(_this.container, 'groupview', true);
|
|
234
237
|
_this._api = new component_api_1.DockviewApi(_this.accessor);
|
|
@@ -259,7 +262,7 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
259
262
|
group: _this.groupPanel,
|
|
260
263
|
getData: dataTransfer_1.getPanelData,
|
|
261
264
|
}));
|
|
262
|
-
}), _this._onMove, _this._onDidChange, _this._onDidDrop, _this._onWillDrop, _this._onDidAddPanel, _this._onDidRemovePanel, _this._onDidActivePanelChange);
|
|
265
|
+
}), _this._onMove, _this._onDidChange, _this._onDidDrop, _this._onWillDrop, _this._onDidAddPanel, _this._onDidRemovePanel, _this._onDidActivePanelChange, _this._onUnhandledDragOverEvent);
|
|
263
266
|
return _this;
|
|
264
267
|
}
|
|
265
268
|
Object.defineProperty(DockviewGroupPanelModel.prototype, "element", {
|
|
@@ -411,33 +414,36 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
411
414
|
// correctly initialized
|
|
412
415
|
this.setActive(this.isActive, true);
|
|
413
416
|
this.updateContainer();
|
|
414
|
-
if (this.accessor.options.
|
|
417
|
+
if (this.accessor.options.createRightHeaderActionComponent) {
|
|
415
418
|
this._rightHeaderActions =
|
|
416
|
-
this.accessor.options.
|
|
419
|
+
this.accessor.options.createRightHeaderActionComponent(this.groupPanel);
|
|
417
420
|
this.addDisposables(this._rightHeaderActions);
|
|
418
421
|
this._rightHeaderActions.init({
|
|
419
422
|
containerApi: this._api,
|
|
420
423
|
api: this.groupPanel.api,
|
|
424
|
+
group: this.groupPanel,
|
|
421
425
|
});
|
|
422
426
|
this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
|
|
423
427
|
}
|
|
424
|
-
if (this.accessor.options.
|
|
428
|
+
if (this.accessor.options.createLeftHeaderActionComponent) {
|
|
425
429
|
this._leftHeaderActions =
|
|
426
|
-
this.accessor.options.
|
|
430
|
+
this.accessor.options.createLeftHeaderActionComponent(this.groupPanel);
|
|
427
431
|
this.addDisposables(this._leftHeaderActions);
|
|
428
432
|
this._leftHeaderActions.init({
|
|
429
433
|
containerApi: this._api,
|
|
430
434
|
api: this.groupPanel.api,
|
|
435
|
+
group: this.groupPanel,
|
|
431
436
|
});
|
|
432
437
|
this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
|
|
433
438
|
}
|
|
434
|
-
if (this.accessor.options.
|
|
439
|
+
if (this.accessor.options.createPrefixHeaderActionComponent) {
|
|
435
440
|
this._prefixHeaderActions =
|
|
436
|
-
this.accessor.options.
|
|
441
|
+
this.accessor.options.createPrefixHeaderActionComponent(this.groupPanel);
|
|
437
442
|
this.addDisposables(this._prefixHeaderActions);
|
|
438
443
|
this._prefixHeaderActions.init({
|
|
439
444
|
containerApi: this._api,
|
|
440
445
|
api: this.groupPanel.api,
|
|
446
|
+
group: this.groupPanel,
|
|
441
447
|
});
|
|
442
448
|
this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
|
|
443
449
|
}
|
|
@@ -650,7 +656,8 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
650
656
|
this.tabsContainer.delete(panel.id);
|
|
651
657
|
this._panels.splice(index, 1);
|
|
652
658
|
if (this.mostRecentlyUsed.includes(panel)) {
|
|
653
|
-
this.mostRecentlyUsed.
|
|
659
|
+
var index_1 = this.mostRecentlyUsed.indexOf(panel);
|
|
660
|
+
this.mostRecentlyUsed.splice(index_1, 1);
|
|
654
661
|
}
|
|
655
662
|
var disposable = this._panelDisposables.get(panel.id);
|
|
656
663
|
if (disposable) {
|
|
@@ -733,17 +740,9 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
733
740
|
}
|
|
734
741
|
};
|
|
735
742
|
DockviewGroupPanelModel.prototype.canDisplayOverlay = function (event, position, target) {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
nativeEvent: event,
|
|
740
|
-
target: target,
|
|
741
|
-
group: this.accessor.getPanel(this.id),
|
|
742
|
-
position: position,
|
|
743
|
-
getData: dataTransfer_1.getPanelData,
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
return false;
|
|
743
|
+
var firedEvent = new options_1.DockviewUnhandledDragOverEvent(event, target, position, dataTransfer_1.getPanelData, this.accessor.getPanel(this.id));
|
|
744
|
+
this._onUnhandledDragOverEvent.fire(firedEvent);
|
|
745
|
+
return firedEvent.isAccepted;
|
|
747
746
|
};
|
|
748
747
|
DockviewGroupPanelModel.prototype.handleDropEvent = function (type, event, position, index) {
|
|
749
748
|
if (this.locked === 'no-drop-target') {
|