dockview-core 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/component.api.d.ts +2 -2
- package/dist/cjs/dockview/components/titlebar/voidContainer.js +0 -1
- package/dist/cjs/dockview/components/watermark/watermark.d.ts +0 -3
- package/dist/cjs/dockview/components/watermark/watermark.js +1 -33
- package/dist/cjs/dockview/dockviewComponent.d.ts +32 -14
- package/dist/cjs/dockview/dockviewComponent.js +53 -19
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +1 -0
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +4 -4
- package/dist/cjs/dockview/options.d.ts +4 -0
- package/dist/cjs/dockview/options.js +1 -0
- package/dist/cjs/gridview/baseComponentGridview.d.ts +8 -3
- package/dist/cjs/gridview/baseComponentGridview.js +8 -8
- package/dist/cjs/gridview/gridview.d.ts +9 -1
- package/dist/cjs/gridview/gridview.js +49 -5
- package/dist/cjs/overlay/overlay.d.ts +3 -0
- package/dist/cjs/overlay/overlay.js +15 -0
- package/dist/dockview-core.amd.js +129 -65
- 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 +128 -64
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +129 -65
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +129 -65
- 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 +129 -65
- 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 +128 -64
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/api/component.api.d.ts +2 -2
- package/dist/esm/dockview/components/titlebar/voidContainer.js +0 -1
- package/dist/esm/dockview/components/watermark/watermark.d.ts +0 -3
- package/dist/esm/dockview/components/watermark/watermark.js +1 -33
- package/dist/esm/dockview/dockviewComponent.d.ts +32 -14
- package/dist/esm/dockview/dockviewComponent.js +53 -19
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +1 -0
- package/dist/esm/dockview/dockviewGroupPanelModel.js +4 -4
- package/dist/esm/dockview/options.d.ts +4 -0
- package/dist/esm/dockview/options.js +1 -0
- package/dist/esm/gridview/baseComponentGridview.d.ts +8 -3
- package/dist/esm/gridview/baseComponentGridview.js +8 -4
- package/dist/esm/gridview/gridview.d.ts +9 -1
- package/dist/esm/gridview/gridview.js +49 -5
- package/dist/esm/overlay/overlay.d.ts +3 -0
- package/dist/esm/overlay/overlay.js +11 -0
- package/dist/styles/dockview.css +4 -33
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FloatingGroupOptions, IDockviewComponent, MovePanelEvent, SerializedDockview } from '../dockview/dockviewComponent';
|
|
1
|
+
import { DockviewMaximizedGroupChanged, FloatingGroupOptions, IDockviewComponent, MovePanelEvent, SerializedDockview } from '../dockview/dockviewComponent';
|
|
2
2
|
import { AddGroupOptions, AddPanelOptions, DockviewComponentOptions, DockviewDndOverlayEvent, MovementOptions } from '../dockview/options';
|
|
3
3
|
import { Parameters } from '../panel/types';
|
|
4
4
|
import { Direction } from '../gridview/baseComponentGridview';
|
|
@@ -497,7 +497,7 @@ export declare class DockviewApi implements CommonApi<SerializedDockview> {
|
|
|
497
497
|
maximizeGroup(panel: IDockviewPanel): void;
|
|
498
498
|
hasMaximizedGroup(): boolean;
|
|
499
499
|
exitMaximizedGroup(): void;
|
|
500
|
-
get onDidMaximizedGroupChange(): Event<
|
|
500
|
+
get onDidMaximizedGroupChange(): Event<DockviewMaximizedGroupChanged>;
|
|
501
501
|
/**
|
|
502
502
|
* Add a popout group in a new Window
|
|
503
503
|
*/
|
|
@@ -34,7 +34,6 @@ var VoidContainer = /** @class */ (function (_super) {
|
|
|
34
34
|
_this.onDragStart = _this._onDragStart.event;
|
|
35
35
|
_this._element = document.createElement('div');
|
|
36
36
|
_this._element.className = 'dv-void-container';
|
|
37
|
-
_this._element.tabIndex = 0;
|
|
38
37
|
_this._element.draggable = true;
|
|
39
38
|
_this.addDisposables(_this._onDrop, _this._onDragStart, (0, events_1.addDisposableListener)(_this._element, 'pointerdown', function () {
|
|
40
39
|
_this.accessor.doSetGroupActive(_this.group);
|
|
@@ -2,10 +2,7 @@ import { IWatermarkRenderer, WatermarkRendererInitParameters } from '../../types
|
|
|
2
2
|
import { CompositeDisposable } from '../../../lifecycle';
|
|
3
3
|
export declare class Watermark extends CompositeDisposable implements IWatermarkRenderer {
|
|
4
4
|
private readonly _element;
|
|
5
|
-
private _group;
|
|
6
|
-
private _api;
|
|
7
5
|
get element(): HTMLElement;
|
|
8
6
|
constructor();
|
|
9
7
|
init(_params: WatermarkRendererInitParameters): void;
|
|
10
|
-
private render;
|
|
11
8
|
}
|
|
@@ -16,39 +16,13 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.Watermark = void 0;
|
|
19
|
-
var events_1 = require("../../../events");
|
|
20
|
-
var dom_1 = require("../../../dom");
|
|
21
19
|
var lifecycle_1 = require("../../../lifecycle");
|
|
22
|
-
var svg_1 = require("../../../svg");
|
|
23
20
|
var Watermark = /** @class */ (function (_super) {
|
|
24
21
|
__extends(Watermark, _super);
|
|
25
22
|
function Watermark() {
|
|
26
23
|
var _this = _super.call(this) || this;
|
|
27
24
|
_this._element = document.createElement('div');
|
|
28
25
|
_this._element.className = 'dv-watermark';
|
|
29
|
-
var title = document.createElement('div');
|
|
30
|
-
title.className = 'dv-watermark-title';
|
|
31
|
-
var emptySpace = document.createElement('span');
|
|
32
|
-
emptySpace.style.flexGrow = '1';
|
|
33
|
-
var content = document.createElement('div');
|
|
34
|
-
content.className = 'dv-watermark-content';
|
|
35
|
-
_this._element.appendChild(title);
|
|
36
|
-
_this._element.appendChild(content);
|
|
37
|
-
var actionsContainer = document.createElement('div');
|
|
38
|
-
actionsContainer.className = 'dv-actions-container';
|
|
39
|
-
var closeAnchor = document.createElement('div');
|
|
40
|
-
closeAnchor.className = 'dv-close-action';
|
|
41
|
-
closeAnchor.appendChild((0, svg_1.createCloseButton)());
|
|
42
|
-
actionsContainer.appendChild(closeAnchor);
|
|
43
|
-
title.appendChild(emptySpace);
|
|
44
|
-
title.appendChild(actionsContainer);
|
|
45
|
-
_this.addDisposables((0, events_1.addDisposableListener)(closeAnchor, 'click', function (event) {
|
|
46
|
-
var _a;
|
|
47
|
-
event.preventDefault();
|
|
48
|
-
if (_this._group) {
|
|
49
|
-
(_a = _this._api) === null || _a === void 0 ? void 0 : _a.removeGroup(_this._group);
|
|
50
|
-
}
|
|
51
|
-
}));
|
|
52
26
|
return _this;
|
|
53
27
|
}
|
|
54
28
|
Object.defineProperty(Watermark.prototype, "element", {
|
|
@@ -59,13 +33,7 @@ var Watermark = /** @class */ (function (_super) {
|
|
|
59
33
|
configurable: true
|
|
60
34
|
});
|
|
61
35
|
Watermark.prototype.init = function (_params) {
|
|
62
|
-
|
|
63
|
-
this._group = _params.group;
|
|
64
|
-
this.render();
|
|
65
|
-
};
|
|
66
|
-
Watermark.prototype.render = function () {
|
|
67
|
-
var isOneGroup = !!(this._api && this._api.size <= 1);
|
|
68
|
-
(0, dom_1.toggleClass)(this.element, 'dv-has-actions', isOneGroup);
|
|
36
|
+
// noop
|
|
69
37
|
};
|
|
70
38
|
return Watermark;
|
|
71
39
|
}(lifecycle_1.CompositeDisposable));
|
|
@@ -14,6 +14,27 @@ import { DockviewFloatingGroupPanel } from './dockviewFloatingGroupPanel';
|
|
|
14
14
|
import { GroupDragEvent, TabDragEvent } from './components/titlebar/tabsContainer';
|
|
15
15
|
import { AnchoredBox, AnchorPosition, Box } from '../types';
|
|
16
16
|
import { DockviewPanelRenderer, OverlayRenderContainer } from '../overlay/overlayRenderContainer';
|
|
17
|
+
export interface DockviewPopoutGroupOptions {
|
|
18
|
+
/**
|
|
19
|
+
* The position of the popout group
|
|
20
|
+
*/
|
|
21
|
+
position?: Box;
|
|
22
|
+
/**
|
|
23
|
+
* The same-origin path at which the popout window will be created
|
|
24
|
+
*
|
|
25
|
+
* Defaults to `/popout.html` if not provided
|
|
26
|
+
*/
|
|
27
|
+
popoutUrl?: string;
|
|
28
|
+
onDidOpen?: (event: {
|
|
29
|
+
id: string;
|
|
30
|
+
window: Window;
|
|
31
|
+
}) => void;
|
|
32
|
+
onWillClose?: (event: {
|
|
33
|
+
id: string;
|
|
34
|
+
window: Window;
|
|
35
|
+
}) => void;
|
|
36
|
+
overridePopoutGroup?: DockviewGroupPanel;
|
|
37
|
+
}
|
|
17
38
|
export interface PanelReference {
|
|
18
39
|
update: (event: {
|
|
19
40
|
params: {
|
|
@@ -28,6 +49,7 @@ export interface SerializedFloatingGroup {
|
|
|
28
49
|
}
|
|
29
50
|
export interface SerializedPopoutGroup {
|
|
30
51
|
data: GroupPanelViewState;
|
|
52
|
+
url?: string;
|
|
31
53
|
gridReferenceGroup?: string;
|
|
32
54
|
position: Box | null;
|
|
33
55
|
}
|
|
@@ -79,6 +101,10 @@ export interface FloatingGroupOptionsInternal extends FloatingGroupOptions {
|
|
|
79
101
|
inDragMode?: boolean;
|
|
80
102
|
skipActiveGroup?: boolean;
|
|
81
103
|
}
|
|
104
|
+
export interface DockviewMaximizedGroupChanged {
|
|
105
|
+
group: DockviewGroupPanel;
|
|
106
|
+
isMaximized: boolean;
|
|
107
|
+
}
|
|
82
108
|
export interface IDockviewComponent extends IBaseGrid<DockviewGroupPanel> {
|
|
83
109
|
readonly activePanel: IDockviewPanel | undefined;
|
|
84
110
|
readonly totalPanels: number;
|
|
@@ -99,6 +125,7 @@ export interface IDockviewComponent extends IBaseGrid<DockviewGroupPanel> {
|
|
|
99
125
|
readonly onDidActiveGroupChange: Event<DockviewGroupPanel | undefined>;
|
|
100
126
|
readonly onUnhandledDragOverEvent: Event<DockviewDndOverlayEvent>;
|
|
101
127
|
readonly onDidMovePanel: Event<MovePanelEvent>;
|
|
128
|
+
readonly onDidMaximizedGroupChange: Event<DockviewMaximizedGroupChanged>;
|
|
102
129
|
readonly options: DockviewComponentOptions;
|
|
103
130
|
updateOptions(options: DockviewOptions): void;
|
|
104
131
|
moveGroupOrPanel(options: MoveGroupOrPanelOptions): void;
|
|
@@ -160,6 +187,8 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
|
|
|
160
187
|
readonly onDidActivePanelChange: Event<IDockviewPanel | undefined>;
|
|
161
188
|
private readonly _onDidMovePanel;
|
|
162
189
|
readonly onDidMovePanel: Event<MovePanelEvent>;
|
|
190
|
+
private readonly _onDidMaximizedGroupChange;
|
|
191
|
+
readonly onDidMaximizedGroupChange: Event<DockviewMaximizedGroupChanged>;
|
|
163
192
|
private readonly _floatingGroups;
|
|
164
193
|
private readonly _popoutGroups;
|
|
165
194
|
private readonly _rootDropTarget;
|
|
@@ -179,19 +208,8 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
|
|
|
179
208
|
get gap(): number;
|
|
180
209
|
get floatingGroups(): DockviewFloatingGroupPanel[];
|
|
181
210
|
constructor(parentElement: HTMLElement, options: DockviewComponentOptions);
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
popoutUrl?: string;
|
|
185
|
-
onDidOpen?: (event: {
|
|
186
|
-
id: string;
|
|
187
|
-
window: Window;
|
|
188
|
-
}) => void;
|
|
189
|
-
onWillClose?: (event: {
|
|
190
|
-
id: string;
|
|
191
|
-
window: Window;
|
|
192
|
-
}) => void;
|
|
193
|
-
overridePopoutGroup?: DockviewGroupPanel;
|
|
194
|
-
}): Promise<boolean>;
|
|
211
|
+
setVisible(panel: DockviewGroupPanel, visible: boolean): void;
|
|
212
|
+
addPopoutGroup(itemToPopout: DockviewPanel | DockviewGroupPanel, options?: DockviewPopoutGroupOptions): Promise<boolean>;
|
|
195
213
|
addFloatingGroup(item: DockviewPanel | DockviewGroupPanel, options?: FloatingGroupOptionsInternal): void;
|
|
196
214
|
private orthogonalize;
|
|
197
215
|
updateOptions(options: Partial<DockviewComponentOptions>): void;
|
|
@@ -213,7 +231,7 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
|
|
|
213
231
|
addPanel<T extends object = Parameters>(options: AddPanelOptions<T>): DockviewPanel;
|
|
214
232
|
removePanel(panel: IDockviewPanel, options?: {
|
|
215
233
|
removeEmptyGroup: boolean;
|
|
216
|
-
skipDispose
|
|
234
|
+
skipDispose?: boolean;
|
|
217
235
|
skipSetActiveGroup?: boolean;
|
|
218
236
|
}): void;
|
|
219
237
|
createWatermarkComponent(): IWatermarkRenderer;
|
|
@@ -144,6 +144,8 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
144
144
|
_this.onDidActivePanelChange = _this._onDidActivePanelChange.event;
|
|
145
145
|
_this._onDidMovePanel = new events_1.Emitter();
|
|
146
146
|
_this.onDidMovePanel = _this._onDidMovePanel.event;
|
|
147
|
+
_this._onDidMaximizedGroupChange = new events_1.Emitter();
|
|
148
|
+
_this.onDidMaximizedGroupChange = _this._onDidMaximizedGroupChange.event;
|
|
147
149
|
_this._floatingGroups = [];
|
|
148
150
|
_this._popoutGroups = [];
|
|
149
151
|
_this._onDidRemoveGroup = new events_1.Emitter();
|
|
@@ -170,6 +172,11 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
170
172
|
if (!_this._moving) {
|
|
171
173
|
_this._onDidActiveGroupChange.fire(event);
|
|
172
174
|
}
|
|
175
|
+
}), _this.onDidMaximizedChange(function (event) {
|
|
176
|
+
_this._onDidMaximizedGroupChange.fire({
|
|
177
|
+
group: event.panel,
|
|
178
|
+
isMaximized: event.isMaximized,
|
|
179
|
+
});
|
|
173
180
|
}), events_1.Event.any(_this.onDidAdd, _this.onDidRemove)(function () {
|
|
174
181
|
_this.updateWatermark();
|
|
175
182
|
}), events_1.Event.any(_this.onDidAddPanel, _this.onDidRemovePanel, _this.onDidAddGroup, _this.onDidRemove, _this.onDidMovePanel, _this.onDidActivePanelChange)(function () {
|
|
@@ -358,9 +365,29 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
358
365
|
enumerable: false,
|
|
359
366
|
configurable: true
|
|
360
367
|
});
|
|
368
|
+
DockviewComponent.prototype.setVisible = function (panel, visible) {
|
|
369
|
+
switch (panel.api.location.type) {
|
|
370
|
+
case 'grid':
|
|
371
|
+
_super.prototype.setVisible.call(this, panel, visible);
|
|
372
|
+
break;
|
|
373
|
+
case 'floating': {
|
|
374
|
+
var item = this.floatingGroups.find(function (floatingGroup) { return floatingGroup.group === panel; });
|
|
375
|
+
if (item) {
|
|
376
|
+
item.overlay.setVisible(visible);
|
|
377
|
+
panel.api._onDidVisibilityChange.fire({
|
|
378
|
+
isVisible: visible,
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
383
|
+
case 'popout':
|
|
384
|
+
console.warn('dockview: You cannot hide a group that is in a popout window');
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
};
|
|
361
388
|
DockviewComponent.prototype.addPopoutGroup = function (itemToPopout, options) {
|
|
362
389
|
var _this = this;
|
|
363
|
-
var _a, _b, _c;
|
|
390
|
+
var _a, _b, _c, _d, _e;
|
|
364
391
|
if (itemToPopout instanceof dockviewPanel_1.DockviewPanel &&
|
|
365
392
|
itemToPopout.group.size === 1) {
|
|
366
393
|
return this.addPopoutGroup(itemToPopout.group, options);
|
|
@@ -383,7 +410,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
383
410
|
var groupId = (_b = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : this.getNextGroupId();
|
|
384
411
|
var _window = new popoutWindow_1.PopoutWindow("".concat(this.id, "-").concat(groupId), // unique id
|
|
385
412
|
theme !== null && theme !== void 0 ? theme : '', {
|
|
386
|
-
url: (_c = options === null || options === void 0 ? void 0 : options.popoutUrl) !== null && _c !== void 0 ? _c : '/popout.html',
|
|
413
|
+
url: (_e = (_c = options === null || options === void 0 ? void 0 : options.popoutUrl) !== null && _c !== void 0 ? _c : (_d = this.options) === null || _d === void 0 ? void 0 : _d.popoutUrl) !== null && _e !== void 0 ? _e : '/popout.html',
|
|
387
414
|
left: window.screenX + box.left,
|
|
388
415
|
top: window.screenY + box.top,
|
|
389
416
|
width: box.width,
|
|
@@ -397,7 +424,6 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
397
424
|
return _window
|
|
398
425
|
.open()
|
|
399
426
|
.then(function (popoutContainer) {
|
|
400
|
-
var _a;
|
|
401
427
|
if (_window.isDisposed) {
|
|
402
428
|
return false;
|
|
403
429
|
}
|
|
@@ -417,14 +443,19 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
417
443
|
* of this case is when being called from the `fromJSON(...)` method
|
|
418
444
|
*/
|
|
419
445
|
var isGroupAddedToDom = referenceGroup.element.parentElement !== null;
|
|
420
|
-
var group
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
446
|
+
var group;
|
|
447
|
+
if (!isGroupAddedToDom) {
|
|
448
|
+
group = referenceGroup;
|
|
449
|
+
}
|
|
450
|
+
else if (options === null || options === void 0 ? void 0 : options.overridePopoutGroup) {
|
|
451
|
+
group = options.overridePopoutGroup;
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
group = _this.createGroup({ id: groupId });
|
|
426
455
|
_this._onDidAddGroup.fire(group);
|
|
427
456
|
}
|
|
457
|
+
group.model.renderContainer = overlayRenderContainer;
|
|
458
|
+
group.layout(_window.window.innerWidth, _window.window.innerHeight);
|
|
428
459
|
if (!(options === null || options === void 0 ? void 0 : options.overridePopoutGroup) && isGroupAddedToDom) {
|
|
429
460
|
if (itemToPopout instanceof dockviewPanel_1.DockviewPanel) {
|
|
430
461
|
_this.movingLock(function () {
|
|
@@ -457,6 +488,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
457
488
|
group.model.location = {
|
|
458
489
|
type: 'popout',
|
|
459
490
|
getWindow: function () { return _window.window; },
|
|
491
|
+
popoutUrl: options === null || options === void 0 ? void 0 : options.popoutUrl,
|
|
460
492
|
};
|
|
461
493
|
if (isGroupAddedToDom &&
|
|
462
494
|
itemToPopout.api.location.type === 'grid') {
|
|
@@ -473,16 +505,15 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
473
505
|
(_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();
|
|
474
506
|
}));
|
|
475
507
|
var returnedGroup;
|
|
508
|
+
var isValidReferenceGroup = isGroupAddedToDom &&
|
|
509
|
+
referenceGroup &&
|
|
510
|
+
_this.getPanel(referenceGroup.id);
|
|
476
511
|
var value = {
|
|
477
512
|
window: _window,
|
|
478
513
|
popoutGroup: group,
|
|
479
|
-
referenceGroup:
|
|
480
|
-
?
|
|
481
|
-
:
|
|
482
|
-
? _this.getPanel(referenceGroup.id)
|
|
483
|
-
? referenceGroup.id
|
|
484
|
-
: undefined
|
|
485
|
-
: undefined,
|
|
514
|
+
referenceGroup: isValidReferenceGroup
|
|
515
|
+
? referenceGroup.id
|
|
516
|
+
: undefined,
|
|
486
517
|
disposable: {
|
|
487
518
|
dispose: function () {
|
|
488
519
|
popoutWindowDisposable.dispose();
|
|
@@ -866,6 +897,9 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
866
897
|
data: group.popoutGroup.toJSON(),
|
|
867
898
|
gridReferenceGroup: group.referenceGroup,
|
|
868
899
|
position: group.window.dimensions(),
|
|
900
|
+
url: group.popoutGroup.api.location.type === 'popout'
|
|
901
|
+
? group.popoutGroup.api.location.popoutUrl
|
|
902
|
+
: undefined,
|
|
869
903
|
};
|
|
870
904
|
});
|
|
871
905
|
var result = {
|
|
@@ -977,7 +1011,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
977
1011
|
try {
|
|
978
1012
|
for (var serializedPopoutGroups_1 = __values(serializedPopoutGroups), serializedPopoutGroups_1_1 = serializedPopoutGroups_1.next(); !serializedPopoutGroups_1_1.done; serializedPopoutGroups_1_1 = serializedPopoutGroups_1.next()) {
|
|
979
1013
|
var serializedPopoutGroup = serializedPopoutGroups_1_1.value;
|
|
980
|
-
var data_2 = serializedPopoutGroup.data, position = serializedPopoutGroup.position, gridReferenceGroup = serializedPopoutGroup.gridReferenceGroup;
|
|
1014
|
+
var data_2 = serializedPopoutGroup.data, position = serializedPopoutGroup.position, gridReferenceGroup = serializedPopoutGroup.gridReferenceGroup, url = serializedPopoutGroup.url;
|
|
981
1015
|
var group = createGroupFromSerializedState_1(data_2);
|
|
982
1016
|
this.addPopoutGroup((_k = (gridReferenceGroup
|
|
983
1017
|
? this.getPanel(gridReferenceGroup)
|
|
@@ -986,6 +1020,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
986
1020
|
overridePopoutGroup: gridReferenceGroup
|
|
987
1021
|
? group
|
|
988
1022
|
: undefined,
|
|
1023
|
+
popoutUrl: url,
|
|
989
1024
|
});
|
|
990
1025
|
}
|
|
991
1026
|
}
|
|
@@ -1276,7 +1311,6 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1276
1311
|
DockviewComponent.prototype.removePanel = function (panel, options) {
|
|
1277
1312
|
if (options === void 0) { options = {
|
|
1278
1313
|
removeEmptyGroup: true,
|
|
1279
|
-
skipDispose: false,
|
|
1280
1314
|
}; }
|
|
1281
1315
|
var group = panel.group;
|
|
1282
1316
|
if (!group) {
|
|
@@ -1431,7 +1465,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1431
1465
|
var refGroup = selectedGroup.referenceGroup
|
|
1432
1466
|
? this.getPanel(selectedGroup.referenceGroup)
|
|
1433
1467
|
: undefined;
|
|
1434
|
-
if (refGroup) {
|
|
1468
|
+
if (refGroup && refGroup.panels.length === 0) {
|
|
1435
1469
|
this.removeGroup(refGroup);
|
|
1436
1470
|
}
|
|
1437
1471
|
}
|
|
@@ -599,7 +599,10 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
599
599
|
this.doClose(panel);
|
|
600
600
|
};
|
|
601
601
|
DockviewGroupPanelModel.prototype.doClose = function (panel) {
|
|
602
|
-
this.accessor.
|
|
602
|
+
var isLast = this.panels.length === 1 && this.accessor.groups.length === 1;
|
|
603
|
+
this.accessor.removePanel(panel, isLast && this.accessor.options.noPanelsOverlay === 'emptyGroup'
|
|
604
|
+
? { removeEmptyGroup: false }
|
|
605
|
+
: undefined);
|
|
603
606
|
};
|
|
604
607
|
DockviewGroupPanelModel.prototype.isPanelActive = function (panel) {
|
|
605
608
|
return this._activePanel === panel;
|
|
@@ -714,7 +717,6 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
714
717
|
DockviewGroupPanelModel.prototype.updateContainer = function () {
|
|
715
718
|
var _this = this;
|
|
716
719
|
var _a, _b;
|
|
717
|
-
(0, dom_1.toggleClass)(this.container, 'dv-empty', this.isEmpty);
|
|
718
720
|
this.panels.forEach(function (panel) { return panel.runEvents(); });
|
|
719
721
|
if (this.isEmpty && !this.watermark) {
|
|
720
722
|
var watermark = this.accessor.createWatermarkComponent();
|
|
@@ -728,14 +730,12 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
728
730
|
_this.accessor.doSetGroupActive(_this.groupPanel);
|
|
729
731
|
}
|
|
730
732
|
});
|
|
731
|
-
this.tabsContainer.hide();
|
|
732
733
|
this.contentContainer.element.appendChild(this.watermark.element);
|
|
733
734
|
}
|
|
734
735
|
if (!this.isEmpty && this.watermark) {
|
|
735
736
|
this.watermark.element.remove();
|
|
736
737
|
(_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
737
738
|
this.watermark = undefined;
|
|
738
|
-
this.tabsContainer.show();
|
|
739
739
|
}
|
|
740
740
|
};
|
|
741
741
|
DockviewGroupPanelModel.prototype.canDisplayOverlay = function (event, position, target) {
|
|
@@ -50,6 +50,10 @@ export interface DockviewOptions {
|
|
|
50
50
|
* Pixel gap between groups
|
|
51
51
|
*/
|
|
52
52
|
gap?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Define the behaviour of the dock when there are no panels to display. Defaults to `watermark`.
|
|
55
|
+
*/
|
|
56
|
+
noPanelsOverlay?: 'emptyGroup' | 'watermark';
|
|
53
57
|
}
|
|
54
58
|
export interface DockviewDndOverlayEvent {
|
|
55
59
|
nativeEvent: DragEvent;
|
|
@@ -8,6 +8,10 @@ import { MovementOptions2 } from '../dockview/options';
|
|
|
8
8
|
import { Resizable } from '../resizable';
|
|
9
9
|
export type Direction = 'left' | 'right' | 'above' | 'below' | 'within';
|
|
10
10
|
export declare function toTarget(direction: Direction): Position;
|
|
11
|
+
export interface MaximizedChanged<T extends IGridPanelView> {
|
|
12
|
+
panel: T;
|
|
13
|
+
isMaximized: boolean;
|
|
14
|
+
}
|
|
11
15
|
export interface BaseGridOptions {
|
|
12
16
|
readonly proportionalLayout: boolean;
|
|
13
17
|
readonly orientation: Orientation;
|
|
@@ -33,6 +37,8 @@ export interface IBaseGrid<T extends IGridPanelView> extends IDisposable {
|
|
|
33
37
|
readonly activeGroup: T | undefined;
|
|
34
38
|
readonly size: number;
|
|
35
39
|
readonly groups: T[];
|
|
40
|
+
readonly onDidMaximizedChange: Event<MaximizedChanged<T>>;
|
|
41
|
+
readonly onDidLayoutChange: Event<void>;
|
|
36
42
|
getPanel(id: string): T | undefined;
|
|
37
43
|
toJSON(): object;
|
|
38
44
|
fromJSON(data: any): void;
|
|
@@ -44,8 +50,6 @@ export interface IBaseGrid<T extends IGridPanelView> extends IDisposable {
|
|
|
44
50
|
isMaximizedGroup(panel: T): boolean;
|
|
45
51
|
exitMaximizedGroup(): void;
|
|
46
52
|
hasMaximizedGroup(): boolean;
|
|
47
|
-
readonly onDidMaximizedGroupChange: Event<void>;
|
|
48
|
-
readonly onDidLayoutChange: Event<void>;
|
|
49
53
|
}
|
|
50
54
|
export declare abstract class BaseGrid<T extends IGridPanelView> extends Resizable implements IBaseGrid<T> {
|
|
51
55
|
private readonly _id;
|
|
@@ -56,6 +60,8 @@ export declare abstract class BaseGrid<T extends IGridPanelView> extends Resizab
|
|
|
56
60
|
readonly onDidRemove: Event<T>;
|
|
57
61
|
private readonly _onDidAdd;
|
|
58
62
|
readonly onDidAdd: Event<T>;
|
|
63
|
+
private readonly _onDidMaximizedChange;
|
|
64
|
+
readonly onDidMaximizedChange: Event<MaximizedChanged<T>>;
|
|
59
65
|
private readonly _onDidActiveChange;
|
|
60
66
|
readonly onDidActiveChange: Event<T | undefined>;
|
|
61
67
|
protected readonly _bufferOnDidLayoutChange: AsapEvent;
|
|
@@ -86,7 +92,6 @@ export declare abstract class BaseGrid<T extends IGridPanelView> extends Resizab
|
|
|
86
92
|
isMaximizedGroup(panel: T): boolean;
|
|
87
93
|
exitMaximizedGroup(): void;
|
|
88
94
|
hasMaximizedGroup(): boolean;
|
|
89
|
-
get onDidMaximizedGroupChange(): Event<void>;
|
|
90
95
|
protected doAddGroup(group: T, location?: number[], size?: number): void;
|
|
91
96
|
protected doRemoveGroup(group: T, options?: {
|
|
92
97
|
skipActive?: boolean;
|
|
@@ -62,6 +62,8 @@ var BaseGrid = /** @class */ (function (_super) {
|
|
|
62
62
|
_this.onDidRemove = _this._onDidRemove.event;
|
|
63
63
|
_this._onDidAdd = new events_1.Emitter();
|
|
64
64
|
_this.onDidAdd = _this._onDidAdd.event;
|
|
65
|
+
_this._onDidMaximizedChange = new events_1.Emitter();
|
|
66
|
+
_this.onDidMaximizedChange = _this._onDidMaximizedChange.event;
|
|
65
67
|
_this._onDidActiveChange = new events_1.Emitter();
|
|
66
68
|
_this.onDidActiveChange = _this._onDidActiveChange.event;
|
|
67
69
|
_this._bufferOnDidLayoutChange = new events_1.AsapEvent();
|
|
@@ -77,7 +79,12 @@ var BaseGrid = /** @class */ (function (_super) {
|
|
|
77
79
|
_this.gridview.locked = !!options.locked;
|
|
78
80
|
_this.element.appendChild(_this.gridview.element);
|
|
79
81
|
_this.layout(0, 0, true); // set some elements height/widths
|
|
80
|
-
_this.addDisposables(_this.gridview.
|
|
82
|
+
_this.addDisposables(_this.gridview.onDidMaximizedNodeChange(function (event) {
|
|
83
|
+
_this._onDidMaximizedChange.fire({
|
|
84
|
+
panel: event.view,
|
|
85
|
+
isMaximized: event.isMaximized,
|
|
86
|
+
});
|
|
87
|
+
}), _this.gridview.onDidViewVisibilityChange(function () {
|
|
81
88
|
return _this._onDidViewVisibilityChangeMicroTaskQueue.fire();
|
|
82
89
|
}), _this.onDidViewVisibilityChangeMicroTaskQueue(function () {
|
|
83
90
|
_this.layout(_this.width, _this.height, true);
|
|
@@ -215,13 +222,6 @@ var BaseGrid = /** @class */ (function (_super) {
|
|
|
215
222
|
BaseGrid.prototype.hasMaximizedGroup = function () {
|
|
216
223
|
return this.gridview.hasMaximizedView();
|
|
217
224
|
};
|
|
218
|
-
Object.defineProperty(BaseGrid.prototype, "onDidMaximizedGroupChange", {
|
|
219
|
-
get: function () {
|
|
220
|
-
return this.gridview.onDidMaximizedNodeChange;
|
|
221
|
-
},
|
|
222
|
-
enumerable: false,
|
|
223
|
-
configurable: true
|
|
224
|
-
});
|
|
225
225
|
BaseGrid.prototype.doAddGroup = function (group, location, size) {
|
|
226
226
|
if (location === void 0) { location = [0]; }
|
|
227
227
|
this.gridview.addView(group, size !== null && size !== void 0 ? size : splitview_1.Sizing.Distribute, location);
|
|
@@ -77,11 +77,19 @@ export interface INodeDescriptor {
|
|
|
77
77
|
export interface IViewDeserializer {
|
|
78
78
|
fromJSON: (data: ISerializedLeafNode) => IGridView;
|
|
79
79
|
}
|
|
80
|
+
export interface SerializedNodeDescriptor {
|
|
81
|
+
location: number[];
|
|
82
|
+
}
|
|
80
83
|
export interface SerializedGridview<T> {
|
|
81
84
|
root: SerializedGridObject<T>;
|
|
82
85
|
width: number;
|
|
83
86
|
height: number;
|
|
84
87
|
orientation: Orientation;
|
|
88
|
+
maximizedNode?: SerializedNodeDescriptor;
|
|
89
|
+
}
|
|
90
|
+
export interface MaximizedViewChanged {
|
|
91
|
+
view: IGridView;
|
|
92
|
+
isMaximized: boolean;
|
|
85
93
|
}
|
|
86
94
|
export declare class Gridview implements IDisposable {
|
|
87
95
|
readonly proportionalLayout: boolean;
|
|
@@ -100,7 +108,7 @@ export declare class Gridview implements IDisposable {
|
|
|
100
108
|
private readonly _onDidViewVisibilityChange;
|
|
101
109
|
readonly onDidViewVisibilityChange: Event<void>;
|
|
102
110
|
private readonly _onDidMaximizedNodeChange;
|
|
103
|
-
readonly onDidMaximizedNodeChange: Event<
|
|
111
|
+
readonly onDidMaximizedNodeChange: Event<MaximizedViewChanged>;
|
|
104
112
|
get length(): number;
|
|
105
113
|
get orientation(): Orientation;
|
|
106
114
|
set orientation(orientation: Orientation);
|
|
@@ -299,6 +299,7 @@ var Gridview = /** @class */ (function () {
|
|
|
299
299
|
if (this.hasMaximizedView()) {
|
|
300
300
|
this.exitMaximizedView();
|
|
301
301
|
}
|
|
302
|
+
serializeBranchNode(this.getView(), this.orientation);
|
|
302
303
|
var hiddenOnMaximize = [];
|
|
303
304
|
function hideAllViewsBut(parent, exclude) {
|
|
304
305
|
for (var i = 0; i < parent.children.length; i++) {
|
|
@@ -320,7 +321,10 @@ var Gridview = /** @class */ (function () {
|
|
|
320
321
|
}
|
|
321
322
|
hideAllViewsBut(this.root, node);
|
|
322
323
|
this._maximizedNode = { leaf: node, hiddenOnMaximize: hiddenOnMaximize };
|
|
323
|
-
this._onDidMaximizedNodeChange.fire(
|
|
324
|
+
this._onDidMaximizedNodeChange.fire({
|
|
325
|
+
view: node.view,
|
|
326
|
+
isMaximized: true,
|
|
327
|
+
});
|
|
324
328
|
};
|
|
325
329
|
Gridview.prototype.exitMaximizedView = function () {
|
|
326
330
|
if (!this._maximizedNode) {
|
|
@@ -341,24 +345,51 @@ var Gridview = /** @class */ (function () {
|
|
|
341
345
|
}
|
|
342
346
|
}
|
|
343
347
|
showViewsInReverseOrder(this.root);
|
|
348
|
+
var tmp = this._maximizedNode.leaf;
|
|
344
349
|
this._maximizedNode = undefined;
|
|
345
|
-
this._onDidMaximizedNodeChange.fire(
|
|
350
|
+
this._onDidMaximizedNodeChange.fire({
|
|
351
|
+
view: tmp.view,
|
|
352
|
+
isMaximized: false,
|
|
353
|
+
});
|
|
346
354
|
};
|
|
347
355
|
Gridview.prototype.serialize = function () {
|
|
356
|
+
var maximizedView = this.maximizedView();
|
|
357
|
+
var maxmizedViewLocation;
|
|
358
|
+
if (maximizedView) {
|
|
359
|
+
/**
|
|
360
|
+
* The minimum information we can get away with in order to serialize a maxmized view is it's location within the grid
|
|
361
|
+
* which is represented as a branch of indices
|
|
362
|
+
*/
|
|
363
|
+
maxmizedViewLocation = getGridLocation(maximizedView.element);
|
|
364
|
+
}
|
|
348
365
|
if (this.hasMaximizedView()) {
|
|
349
366
|
/**
|
|
350
|
-
*
|
|
351
|
-
*
|
|
367
|
+
* the saved layout cannot be in its maxmized state otherwise all of the underlying
|
|
368
|
+
* view dimensions will be wrong
|
|
369
|
+
*
|
|
370
|
+
* To counteract this we temporaily remove the maximized view to compute the serialized output
|
|
371
|
+
* of the grid before adding back the maxmized view as to not alter the layout from the users
|
|
372
|
+
* perspective when `.toJSON()` is called
|
|
352
373
|
*/
|
|
353
374
|
this.exitMaximizedView();
|
|
354
375
|
}
|
|
355
376
|
var root = serializeBranchNode(this.getView(), this.orientation);
|
|
356
|
-
|
|
377
|
+
var resullt = {
|
|
357
378
|
root: root,
|
|
358
379
|
width: this.width,
|
|
359
380
|
height: this.height,
|
|
360
381
|
orientation: this.orientation,
|
|
361
382
|
};
|
|
383
|
+
if (maxmizedViewLocation) {
|
|
384
|
+
resullt.maximizedNode = {
|
|
385
|
+
location: maxmizedViewLocation,
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
if (maximizedView) {
|
|
389
|
+
// replace any maximzied view that was removed for serialization purposes
|
|
390
|
+
this.maximizeView(maximizedView);
|
|
391
|
+
}
|
|
392
|
+
return resullt;
|
|
362
393
|
};
|
|
363
394
|
Gridview.prototype.dispose = function () {
|
|
364
395
|
this.disposable.dispose();
|
|
@@ -377,6 +408,19 @@ var Gridview = /** @class */ (function () {
|
|
|
377
408
|
var orientation = json.orientation;
|
|
378
409
|
var height = orientation === splitview_1.Orientation.VERTICAL ? json.height : json.width;
|
|
379
410
|
this._deserialize(json.root, orientation, deserializer, height);
|
|
411
|
+
/**
|
|
412
|
+
* The deserialied layout must be positioned through this.layout(...)
|
|
413
|
+
* before any maximizedNode can be positioned
|
|
414
|
+
*/
|
|
415
|
+
this.layout(json.width, json.height);
|
|
416
|
+
if (json.maximizedNode) {
|
|
417
|
+
var location_1 = json.maximizedNode.location;
|
|
418
|
+
var _a = __read(this.getNode(location_1), 2), _ = _a[0], node = _a[1];
|
|
419
|
+
if (!(node instanceof leafNode_1.LeafNode)) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
this.maximizeView(node.view);
|
|
423
|
+
}
|
|
380
424
|
};
|
|
381
425
|
Gridview.prototype._deserialize = function (root, orientation, deserializer, orthogonalSize) {
|
|
382
426
|
this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize);
|
|
@@ -12,15 +12,18 @@ export declare class Overlay extends CompositeDisposable {
|
|
|
12
12
|
private static readonly MINIMUM_WIDTH;
|
|
13
13
|
private verticalAlignment;
|
|
14
14
|
private horiziontalAlignment;
|
|
15
|
+
private _isVisible;
|
|
15
16
|
set minimumInViewportWidth(value: number | undefined);
|
|
16
17
|
set minimumInViewportHeight(value: number | undefined);
|
|
17
18
|
get element(): HTMLElement;
|
|
19
|
+
get isVisible(): boolean;
|
|
18
20
|
constructor(options: AnchoredBox & {
|
|
19
21
|
container: HTMLElement;
|
|
20
22
|
content: HTMLElement;
|
|
21
23
|
minimumInViewportWidth?: number;
|
|
22
24
|
minimumInViewportHeight?: number;
|
|
23
25
|
});
|
|
26
|
+
setVisible(isVisible: boolean): void;
|
|
24
27
|
bringToFront(): void;
|
|
25
28
|
setBounds(bounds?: Partial<AnchoredBox>): void;
|
|
26
29
|
toJSON(): AnchoredBox;
|