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
|
*/
|
|
@@ -18,7 +18,6 @@ export class VoidContainer extends CompositeDisposable {
|
|
|
18
18
|
this.onDragStart = this._onDragStart.event;
|
|
19
19
|
this._element = document.createElement('div');
|
|
20
20
|
this._element.className = 'dv-void-container';
|
|
21
|
-
this._element.tabIndex = 0;
|
|
22
21
|
this._element.draggable = true;
|
|
23
22
|
this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'pointerdown', () => {
|
|
24
23
|
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
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { addDisposableListener } from '../../../events';
|
|
2
|
-
import { toggleClass } from '../../../dom';
|
|
3
1
|
import { CompositeDisposable } from '../../../lifecycle';
|
|
4
|
-
import { createCloseButton } from '../../../svg';
|
|
5
2
|
export class Watermark extends CompositeDisposable {
|
|
6
3
|
get element() {
|
|
7
4
|
return this._element;
|
|
@@ -10,37 +7,8 @@ export class Watermark extends CompositeDisposable {
|
|
|
10
7
|
super();
|
|
11
8
|
this._element = document.createElement('div');
|
|
12
9
|
this._element.className = 'dv-watermark';
|
|
13
|
-
const title = document.createElement('div');
|
|
14
|
-
title.className = 'dv-watermark-title';
|
|
15
|
-
const emptySpace = document.createElement('span');
|
|
16
|
-
emptySpace.style.flexGrow = '1';
|
|
17
|
-
const content = document.createElement('div');
|
|
18
|
-
content.className = 'dv-watermark-content';
|
|
19
|
-
this._element.appendChild(title);
|
|
20
|
-
this._element.appendChild(content);
|
|
21
|
-
const actionsContainer = document.createElement('div');
|
|
22
|
-
actionsContainer.className = 'dv-actions-container';
|
|
23
|
-
const closeAnchor = document.createElement('div');
|
|
24
|
-
closeAnchor.className = 'dv-close-action';
|
|
25
|
-
closeAnchor.appendChild(createCloseButton());
|
|
26
|
-
actionsContainer.appendChild(closeAnchor);
|
|
27
|
-
title.appendChild(emptySpace);
|
|
28
|
-
title.appendChild(actionsContainer);
|
|
29
|
-
this.addDisposables(addDisposableListener(closeAnchor, 'click', (event) => {
|
|
30
|
-
var _a;
|
|
31
|
-
event.preventDefault();
|
|
32
|
-
if (this._group) {
|
|
33
|
-
(_a = this._api) === null || _a === void 0 ? void 0 : _a.removeGroup(this._group);
|
|
34
|
-
}
|
|
35
|
-
}));
|
|
36
10
|
}
|
|
37
11
|
init(_params) {
|
|
38
|
-
|
|
39
|
-
this._group = _params.group;
|
|
40
|
-
this.render();
|
|
41
|
-
}
|
|
42
|
-
render() {
|
|
43
|
-
const isOneGroup = !!(this._api && this._api.size <= 1);
|
|
44
|
-
toggleClass(this.element, 'dv-has-actions', isOneGroup);
|
|
12
|
+
// noop
|
|
45
13
|
}
|
|
46
14
|
}
|
|
@@ -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;
|
|
@@ -110,6 +110,8 @@ export class DockviewComponent extends BaseGrid {
|
|
|
110
110
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
111
111
|
this._onDidMovePanel = new Emitter();
|
|
112
112
|
this.onDidMovePanel = this._onDidMovePanel.event;
|
|
113
|
+
this._onDidMaximizedGroupChange = new Emitter();
|
|
114
|
+
this.onDidMaximizedGroupChange = this._onDidMaximizedGroupChange.event;
|
|
113
115
|
this._floatingGroups = [];
|
|
114
116
|
this._popoutGroups = [];
|
|
115
117
|
this._onDidRemoveGroup = new Emitter();
|
|
@@ -136,6 +138,11 @@ export class DockviewComponent extends BaseGrid {
|
|
|
136
138
|
if (!this._moving) {
|
|
137
139
|
this._onDidActiveGroupChange.fire(event);
|
|
138
140
|
}
|
|
141
|
+
}), this.onDidMaximizedChange((event) => {
|
|
142
|
+
this._onDidMaximizedGroupChange.fire({
|
|
143
|
+
group: event.panel,
|
|
144
|
+
isMaximized: event.isMaximized,
|
|
145
|
+
});
|
|
139
146
|
}), Event.any(this.onDidAdd, this.onDidRemove)(() => {
|
|
140
147
|
this.updateWatermark();
|
|
141
148
|
}), Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidAddGroup, this.onDidRemove, this.onDidMovePanel, this.onDidActivePanelChange)(() => {
|
|
@@ -234,8 +241,28 @@ export class DockviewComponent extends BaseGrid {
|
|
|
234
241
|
this._api = new DockviewApi(this);
|
|
235
242
|
this.updateWatermark();
|
|
236
243
|
}
|
|
244
|
+
setVisible(panel, visible) {
|
|
245
|
+
switch (panel.api.location.type) {
|
|
246
|
+
case 'grid':
|
|
247
|
+
super.setVisible(panel, visible);
|
|
248
|
+
break;
|
|
249
|
+
case 'floating': {
|
|
250
|
+
const item = this.floatingGroups.find((floatingGroup) => floatingGroup.group === panel);
|
|
251
|
+
if (item) {
|
|
252
|
+
item.overlay.setVisible(visible);
|
|
253
|
+
panel.api._onDidVisibilityChange.fire({
|
|
254
|
+
isVisible: visible,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
case 'popout':
|
|
260
|
+
console.warn('dockview: You cannot hide a group that is in a popout window');
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
237
264
|
addPopoutGroup(itemToPopout, options) {
|
|
238
|
-
var _a, _b, _c;
|
|
265
|
+
var _a, _b, _c, _d, _e;
|
|
239
266
|
if (itemToPopout instanceof DockviewPanel &&
|
|
240
267
|
itemToPopout.group.size === 1) {
|
|
241
268
|
return this.addPopoutGroup(itemToPopout.group, options);
|
|
@@ -258,7 +285,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
258
285
|
const 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();
|
|
259
286
|
const _window = new PopoutWindow(`${this.id}-${groupId}`, // unique id
|
|
260
287
|
theme !== null && theme !== void 0 ? theme : '', {
|
|
261
|
-
url: (_c = options === null || options === void 0 ? void 0 : options.popoutUrl) !== null && _c !== void 0 ? _c : '/popout.html',
|
|
288
|
+
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',
|
|
262
289
|
left: window.screenX + box.left,
|
|
263
290
|
top: window.screenY + box.top,
|
|
264
291
|
width: box.width,
|
|
@@ -272,7 +299,6 @@ export class DockviewComponent extends BaseGrid {
|
|
|
272
299
|
return _window
|
|
273
300
|
.open()
|
|
274
301
|
.then((popoutContainer) => {
|
|
275
|
-
var _a;
|
|
276
302
|
if (_window.isDisposed) {
|
|
277
303
|
return false;
|
|
278
304
|
}
|
|
@@ -292,14 +318,19 @@ export class DockviewComponent extends BaseGrid {
|
|
|
292
318
|
* of this case is when being called from the `fromJSON(...)` method
|
|
293
319
|
*/
|
|
294
320
|
const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
321
|
+
let group;
|
|
322
|
+
if (!isGroupAddedToDom) {
|
|
323
|
+
group = referenceGroup;
|
|
324
|
+
}
|
|
325
|
+
else if (options === null || options === void 0 ? void 0 : options.overridePopoutGroup) {
|
|
326
|
+
group = options.overridePopoutGroup;
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
group = this.createGroup({ id: groupId });
|
|
301
330
|
this._onDidAddGroup.fire(group);
|
|
302
331
|
}
|
|
332
|
+
group.model.renderContainer = overlayRenderContainer;
|
|
333
|
+
group.layout(_window.window.innerWidth, _window.window.innerHeight);
|
|
303
334
|
if (!(options === null || options === void 0 ? void 0 : options.overridePopoutGroup) && isGroupAddedToDom) {
|
|
304
335
|
if (itemToPopout instanceof DockviewPanel) {
|
|
305
336
|
this.movingLock(() => {
|
|
@@ -330,6 +361,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
330
361
|
group.model.location = {
|
|
331
362
|
type: 'popout',
|
|
332
363
|
getWindow: () => _window.window,
|
|
364
|
+
popoutUrl: options === null || options === void 0 ? void 0 : options.popoutUrl,
|
|
333
365
|
};
|
|
334
366
|
if (isGroupAddedToDom &&
|
|
335
367
|
itemToPopout.api.location.type === 'grid') {
|
|
@@ -346,16 +378,15 @@ export class DockviewComponent extends BaseGrid {
|
|
|
346
378
|
(_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();
|
|
347
379
|
}));
|
|
348
380
|
let returnedGroup;
|
|
381
|
+
const isValidReferenceGroup = isGroupAddedToDom &&
|
|
382
|
+
referenceGroup &&
|
|
383
|
+
this.getPanel(referenceGroup.id);
|
|
349
384
|
const value = {
|
|
350
385
|
window: _window,
|
|
351
386
|
popoutGroup: group,
|
|
352
|
-
referenceGroup:
|
|
353
|
-
?
|
|
354
|
-
:
|
|
355
|
-
? this.getPanel(referenceGroup.id)
|
|
356
|
-
? referenceGroup.id
|
|
357
|
-
: undefined
|
|
358
|
-
: undefined,
|
|
387
|
+
referenceGroup: isValidReferenceGroup
|
|
388
|
+
? referenceGroup.id
|
|
389
|
+
: undefined,
|
|
359
390
|
disposable: {
|
|
360
391
|
dispose: () => {
|
|
361
392
|
popoutWindowDisposable.dispose();
|
|
@@ -706,6 +737,9 @@ export class DockviewComponent extends BaseGrid {
|
|
|
706
737
|
data: group.popoutGroup.toJSON(),
|
|
707
738
|
gridReferenceGroup: group.referenceGroup,
|
|
708
739
|
position: group.window.dimensions(),
|
|
740
|
+
url: group.popoutGroup.api.location.type === 'popout'
|
|
741
|
+
? group.popoutGroup.api.location.popoutUrl
|
|
742
|
+
: undefined,
|
|
709
743
|
};
|
|
710
744
|
});
|
|
711
745
|
const result = {
|
|
@@ -792,7 +826,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
792
826
|
}
|
|
793
827
|
const serializedPopoutGroups = (_b = data.popoutGroups) !== null && _b !== void 0 ? _b : [];
|
|
794
828
|
for (const serializedPopoutGroup of serializedPopoutGroups) {
|
|
795
|
-
const { data, position, gridReferenceGroup } = serializedPopoutGroup;
|
|
829
|
+
const { data, position, gridReferenceGroup, url } = serializedPopoutGroup;
|
|
796
830
|
const group = createGroupFromSerializedState(data);
|
|
797
831
|
this.addPopoutGroup((_c = (gridReferenceGroup
|
|
798
832
|
? this.getPanel(gridReferenceGroup)
|
|
@@ -801,6 +835,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
801
835
|
overridePopoutGroup: gridReferenceGroup
|
|
802
836
|
? group
|
|
803
837
|
: undefined,
|
|
838
|
+
popoutUrl: url,
|
|
804
839
|
});
|
|
805
840
|
}
|
|
806
841
|
for (const floatingGroup of this._floatingGroups) {
|
|
@@ -1010,7 +1045,6 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1010
1045
|
}
|
|
1011
1046
|
removePanel(panel, options = {
|
|
1012
1047
|
removeEmptyGroup: true,
|
|
1013
|
-
skipDispose: false,
|
|
1014
1048
|
}) {
|
|
1015
1049
|
const group = panel.group;
|
|
1016
1050
|
if (!group) {
|
|
@@ -1154,7 +1188,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1154
1188
|
const refGroup = selectedGroup.referenceGroup
|
|
1155
1189
|
? this.getPanel(selectedGroup.referenceGroup)
|
|
1156
1190
|
: undefined;
|
|
1157
|
-
if (refGroup) {
|
|
1191
|
+
if (refGroup && refGroup.panels.length === 0) {
|
|
1158
1192
|
this.removeGroup(refGroup);
|
|
1159
1193
|
}
|
|
1160
1194
|
}
|
|
@@ -418,7 +418,10 @@ export class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
418
418
|
this.doClose(panel);
|
|
419
419
|
}
|
|
420
420
|
doClose(panel) {
|
|
421
|
-
this.accessor.
|
|
421
|
+
const isLast = this.panels.length === 1 && this.accessor.groups.length === 1;
|
|
422
|
+
this.accessor.removePanel(panel, isLast && this.accessor.options.noPanelsOverlay === 'emptyGroup'
|
|
423
|
+
? { removeEmptyGroup: false }
|
|
424
|
+
: undefined);
|
|
422
425
|
}
|
|
423
426
|
isPanelActive(panel) {
|
|
424
427
|
return this._activePanel === panel;
|
|
@@ -524,7 +527,6 @@ export class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
524
527
|
}
|
|
525
528
|
updateContainer() {
|
|
526
529
|
var _a, _b;
|
|
527
|
-
toggleClass(this.container, 'dv-empty', this.isEmpty);
|
|
528
530
|
this.panels.forEach((panel) => panel.runEvents());
|
|
529
531
|
if (this.isEmpty && !this.watermark) {
|
|
530
532
|
const watermark = this.accessor.createWatermarkComponent();
|
|
@@ -538,14 +540,12 @@ export class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
538
540
|
this.accessor.doSetGroupActive(this.groupPanel);
|
|
539
541
|
}
|
|
540
542
|
});
|
|
541
|
-
this.tabsContainer.hide();
|
|
542
543
|
this.contentContainer.element.appendChild(this.watermark.element);
|
|
543
544
|
}
|
|
544
545
|
if (!this.isEmpty && this.watermark) {
|
|
545
546
|
this.watermark.element.remove();
|
|
546
547
|
(_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
547
548
|
this.watermark = undefined;
|
|
548
|
-
this.tabsContainer.show();
|
|
549
549
|
}
|
|
550
550
|
}
|
|
551
551
|
canDisplayOverlay(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;
|
|
@@ -67,6 +67,8 @@ export class BaseGrid extends Resizable {
|
|
|
67
67
|
this.onDidRemove = this._onDidRemove.event;
|
|
68
68
|
this._onDidAdd = new Emitter();
|
|
69
69
|
this.onDidAdd = this._onDidAdd.event;
|
|
70
|
+
this._onDidMaximizedChange = new Emitter();
|
|
71
|
+
this.onDidMaximizedChange = this._onDidMaximizedChange.event;
|
|
70
72
|
this._onDidActiveChange = new Emitter();
|
|
71
73
|
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
72
74
|
this._bufferOnDidLayoutChange = new AsapEvent();
|
|
@@ -82,7 +84,12 @@ export class BaseGrid extends Resizable {
|
|
|
82
84
|
this.gridview.locked = !!options.locked;
|
|
83
85
|
this.element.appendChild(this.gridview.element);
|
|
84
86
|
this.layout(0, 0, true); // set some elements height/widths
|
|
85
|
-
this.addDisposables(this.gridview.
|
|
87
|
+
this.addDisposables(this.gridview.onDidMaximizedNodeChange((event) => {
|
|
88
|
+
this._onDidMaximizedChange.fire({
|
|
89
|
+
panel: event.view,
|
|
90
|
+
isMaximized: event.isMaximized,
|
|
91
|
+
});
|
|
92
|
+
}), this.gridview.onDidViewVisibilityChange(() => this._onDidViewVisibilityChangeMicroTaskQueue.fire()), this.onDidViewVisibilityChangeMicroTaskQueue(() => {
|
|
86
93
|
this.layout(this.width, this.height, true);
|
|
87
94
|
}), Disposable.from(() => {
|
|
88
95
|
var _a;
|
|
@@ -137,9 +144,6 @@ export class BaseGrid extends Resizable {
|
|
|
137
144
|
hasMaximizedGroup() {
|
|
138
145
|
return this.gridview.hasMaximizedView();
|
|
139
146
|
}
|
|
140
|
-
get onDidMaximizedGroupChange() {
|
|
141
|
-
return this.gridview.onDidMaximizedNodeChange;
|
|
142
|
-
}
|
|
143
147
|
doAddGroup(group, location = [0], size) {
|
|
144
148
|
this.gridview.addView(group, size !== null && size !== void 0 ? size : Sizing.Distribute, location);
|
|
145
149
|
this._onDidAdd.fire(group);
|
|
@@ -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);
|
|
@@ -201,6 +201,7 @@ export class Gridview {
|
|
|
201
201
|
if (this.hasMaximizedView()) {
|
|
202
202
|
this.exitMaximizedView();
|
|
203
203
|
}
|
|
204
|
+
serializeBranchNode(this.getView(), this.orientation);
|
|
204
205
|
const hiddenOnMaximize = [];
|
|
205
206
|
function hideAllViewsBut(parent, exclude) {
|
|
206
207
|
for (let i = 0; i < parent.children.length; i++) {
|
|
@@ -222,7 +223,10 @@ export class Gridview {
|
|
|
222
223
|
}
|
|
223
224
|
hideAllViewsBut(this.root, node);
|
|
224
225
|
this._maximizedNode = { leaf: node, hiddenOnMaximize };
|
|
225
|
-
this._onDidMaximizedNodeChange.fire(
|
|
226
|
+
this._onDidMaximizedNodeChange.fire({
|
|
227
|
+
view: node.view,
|
|
228
|
+
isMaximized: true,
|
|
229
|
+
});
|
|
226
230
|
}
|
|
227
231
|
exitMaximizedView() {
|
|
228
232
|
if (!this._maximizedNode) {
|
|
@@ -243,24 +247,51 @@ export class Gridview {
|
|
|
243
247
|
}
|
|
244
248
|
}
|
|
245
249
|
showViewsInReverseOrder(this.root);
|
|
250
|
+
const tmp = this._maximizedNode.leaf;
|
|
246
251
|
this._maximizedNode = undefined;
|
|
247
|
-
this._onDidMaximizedNodeChange.fire(
|
|
252
|
+
this._onDidMaximizedNodeChange.fire({
|
|
253
|
+
view: tmp.view,
|
|
254
|
+
isMaximized: false,
|
|
255
|
+
});
|
|
248
256
|
}
|
|
249
257
|
serialize() {
|
|
258
|
+
const maximizedView = this.maximizedView();
|
|
259
|
+
let maxmizedViewLocation;
|
|
260
|
+
if (maximizedView) {
|
|
261
|
+
/**
|
|
262
|
+
* The minimum information we can get away with in order to serialize a maxmized view is it's location within the grid
|
|
263
|
+
* which is represented as a branch of indices
|
|
264
|
+
*/
|
|
265
|
+
maxmizedViewLocation = getGridLocation(maximizedView.element);
|
|
266
|
+
}
|
|
250
267
|
if (this.hasMaximizedView()) {
|
|
251
268
|
/**
|
|
252
|
-
*
|
|
253
|
-
*
|
|
269
|
+
* the saved layout cannot be in its maxmized state otherwise all of the underlying
|
|
270
|
+
* view dimensions will be wrong
|
|
271
|
+
*
|
|
272
|
+
* To counteract this we temporaily remove the maximized view to compute the serialized output
|
|
273
|
+
* of the grid before adding back the maxmized view as to not alter the layout from the users
|
|
274
|
+
* perspective when `.toJSON()` is called
|
|
254
275
|
*/
|
|
255
276
|
this.exitMaximizedView();
|
|
256
277
|
}
|
|
257
278
|
const root = serializeBranchNode(this.getView(), this.orientation);
|
|
258
|
-
|
|
279
|
+
const resullt = {
|
|
259
280
|
root,
|
|
260
281
|
width: this.width,
|
|
261
282
|
height: this.height,
|
|
262
283
|
orientation: this.orientation,
|
|
263
284
|
};
|
|
285
|
+
if (maxmizedViewLocation) {
|
|
286
|
+
resullt.maximizedNode = {
|
|
287
|
+
location: maxmizedViewLocation,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
if (maximizedView) {
|
|
291
|
+
// replace any maximzied view that was removed for serialization purposes
|
|
292
|
+
this.maximizeView(maximizedView);
|
|
293
|
+
}
|
|
294
|
+
return resullt;
|
|
264
295
|
}
|
|
265
296
|
dispose() {
|
|
266
297
|
this.disposable.dispose();
|
|
@@ -279,6 +310,19 @@ export class Gridview {
|
|
|
279
310
|
const orientation = json.orientation;
|
|
280
311
|
const height = orientation === Orientation.VERTICAL ? json.height : json.width;
|
|
281
312
|
this._deserialize(json.root, orientation, deserializer, height);
|
|
313
|
+
/**
|
|
314
|
+
* The deserialied layout must be positioned through this.layout(...)
|
|
315
|
+
* before any maximizedNode can be positioned
|
|
316
|
+
*/
|
|
317
|
+
this.layout(json.width, json.height);
|
|
318
|
+
if (json.maximizedNode) {
|
|
319
|
+
const location = json.maximizedNode.location;
|
|
320
|
+
const [_, node] = this.getNode(location);
|
|
321
|
+
if (!(node instanceof LeafNode)) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
this.maximizeView(node.view);
|
|
325
|
+
}
|
|
282
326
|
}
|
|
283
327
|
_deserialize(root, orientation, deserializer, orthogonalSize) {
|
|
284
328
|
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;
|
|
@@ -35,6 +35,9 @@ export class Overlay extends CompositeDisposable {
|
|
|
35
35
|
get element() {
|
|
36
36
|
return this._element;
|
|
37
37
|
}
|
|
38
|
+
get isVisible() {
|
|
39
|
+
return this._isVisible;
|
|
40
|
+
}
|
|
38
41
|
constructor(options) {
|
|
39
42
|
super();
|
|
40
43
|
this.options = options;
|
|
@@ -45,6 +48,7 @@ export class Overlay extends CompositeDisposable {
|
|
|
45
48
|
this.onDidChangeEnd = this._onDidChangeEnd.event;
|
|
46
49
|
this.addDisposables(this._onDidChange, this._onDidChangeEnd);
|
|
47
50
|
this._element.className = 'dv-resize-container';
|
|
51
|
+
this._isVisible = true;
|
|
48
52
|
this.setupResize('top');
|
|
49
53
|
this.setupResize('bottom');
|
|
50
54
|
this.setupResize('left');
|
|
@@ -59,6 +63,13 @@ export class Overlay extends CompositeDisposable {
|
|
|
59
63
|
this.setBounds(Object.assign(Object.assign(Object.assign(Object.assign({ height: this.options.height, width: this.options.width }, ('top' in this.options && { top: this.options.top })), ('bottom' in this.options && { bottom: this.options.bottom })), ('left' in this.options && { left: this.options.left })), ('right' in this.options && { right: this.options.right })));
|
|
60
64
|
arialLevelTracker.push(this._element);
|
|
61
65
|
}
|
|
66
|
+
setVisible(isVisible) {
|
|
67
|
+
if (isVisible === this.isVisible) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
this._isVisible = isVisible;
|
|
71
|
+
toggleClass(this.element, 'dv-hidden', !this.isVisible);
|
|
72
|
+
}
|
|
62
73
|
bringToFront() {
|
|
63
74
|
arialLevelTracker.push(this._element);
|
|
64
75
|
}
|