dockview-core 2.1.1 → 2.1.3
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/dockview/dockviewComponent.d.ts +1 -0
- package/dist/cjs/dockview/dockviewComponent.js +42 -17
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +1 -1
- package/dist/cjs/dockview/strictEventsSequencing.d.ts +7 -0
- package/dist/cjs/dockview/strictEventsSequencing.js +63 -0
- package/dist/cjs/gridview/baseComponentGridview.js +1 -1
- package/dist/dockview-core.amd.js +81 -18
- 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 +81 -18
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +81 -18
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +81 -18
- 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 +81 -18
- 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 +81 -18
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/dockview/dockviewComponent.d.ts +1 -0
- package/dist/esm/dockview/dockviewComponent.js +38 -15
- package/dist/esm/dockview/dockviewGroupPanelModel.js +1 -1
- package/dist/esm/dockview/strictEventsSequencing.d.ts +7 -0
- package/dist/esm/dockview/strictEventsSequencing.js +41 -0
- package/dist/esm/gridview/baseComponentGridview.js +1 -1
- package/package.json +1 -1
|
@@ -208,6 +208,7 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
|
|
|
208
208
|
get gap(): number;
|
|
209
209
|
get floatingGroups(): DockviewFloatingGroupPanel[];
|
|
210
210
|
constructor(parentElement: HTMLElement, options: DockviewComponentOptions);
|
|
211
|
+
dispose(): void;
|
|
211
212
|
setVisible(panel: DockviewGroupPanel, visible: boolean): void;
|
|
212
213
|
addPopoutGroup(itemToPopout: DockviewPanel | DockviewGroupPanel, options?: DockviewPopoutGroupOptions): Promise<boolean>;
|
|
213
214
|
addFloatingGroup(item: DockviewPanel | DockviewGroupPanel, options?: FloatingGroupOptionsInternal): void;
|
|
@@ -21,6 +21,7 @@ import { DockviewFloatingGroupPanel } from './dockviewFloatingGroupPanel';
|
|
|
21
21
|
import { DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE, DEFAULT_FLOATING_GROUP_POSITION, } from '../constants';
|
|
22
22
|
import { OverlayRenderContainer, } from '../overlay/overlayRenderContainer';
|
|
23
23
|
import { PopoutWindow } from '../popoutWindow';
|
|
24
|
+
import { StrictEventsSequencing } from './strictEventsSequencing';
|
|
24
25
|
const DEFAULT_ROOT_OVERLAY_MODEL = {
|
|
25
26
|
activationSize: { type: 'pixels', value: 10 },
|
|
26
27
|
size: { type: 'pixels', value: 20 },
|
|
@@ -124,7 +125,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
124
125
|
this.overlayRenderContainer = new OverlayRenderContainer(this.gridview.element, this);
|
|
125
126
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
126
127
|
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
127
|
-
|
|
128
|
+
if (options.debug) {
|
|
129
|
+
this.addDisposables(new StrictEventsSequencing(this));
|
|
130
|
+
}
|
|
131
|
+
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._onDidMaximizedGroupChange, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
|
|
128
132
|
this.updateWatermark();
|
|
129
133
|
}), this.onDidAdd((event) => {
|
|
130
134
|
if (!this._moving) {
|
|
@@ -241,6 +245,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
241
245
|
this._api = new DockviewApi(this);
|
|
242
246
|
this.updateWatermark();
|
|
243
247
|
}
|
|
248
|
+
dispose() {
|
|
249
|
+
this.clear(); // explicitly clear the layout before cleaning up
|
|
250
|
+
super.dispose();
|
|
251
|
+
}
|
|
244
252
|
setVisible(panel, visible) {
|
|
245
253
|
switch (panel.api.location.type) {
|
|
246
254
|
case 'grid':
|
|
@@ -299,6 +307,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
299
307
|
return _window
|
|
300
308
|
.open()
|
|
301
309
|
.then((popoutContainer) => {
|
|
310
|
+
var _a;
|
|
302
311
|
if (_window.isDisposed) {
|
|
303
312
|
return false;
|
|
304
313
|
}
|
|
@@ -331,6 +340,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
331
340
|
}
|
|
332
341
|
group.model.renderContainer = overlayRenderContainer;
|
|
333
342
|
group.layout(_window.window.innerWidth, _window.window.innerHeight);
|
|
343
|
+
let floatingBox;
|
|
334
344
|
if (!(options === null || options === void 0 ? void 0 : options.overridePopoutGroup) && isGroupAddedToDom) {
|
|
335
345
|
if (itemToPopout instanceof DockviewPanel) {
|
|
336
346
|
this.movingLock(() => {
|
|
@@ -349,6 +359,9 @@ export class DockviewComponent extends BaseGrid {
|
|
|
349
359
|
break;
|
|
350
360
|
case 'floating':
|
|
351
361
|
case 'popout':
|
|
362
|
+
floatingBox = (_a = this._floatingGroups
|
|
363
|
+
.find((value) => value.group.api.id ===
|
|
364
|
+
itemToPopout.api.id)) === null || _a === void 0 ? void 0 : _a.overlay.toJSON();
|
|
352
365
|
this.removeGroup(referenceGroup);
|
|
353
366
|
break;
|
|
354
367
|
}
|
|
@@ -419,17 +432,29 @@ export class DockviewComponent extends BaseGrid {
|
|
|
419
432
|
}
|
|
420
433
|
}
|
|
421
434
|
else if (this.getPanel(group.id)) {
|
|
422
|
-
this.doRemoveGroup(group, {
|
|
423
|
-
skipDispose: true,
|
|
424
|
-
skipActive: true,
|
|
425
|
-
skipPopoutReturn: true,
|
|
426
|
-
});
|
|
427
435
|
const removedGroup = group;
|
|
428
|
-
|
|
429
|
-
this.
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
436
|
+
if (floatingBox) {
|
|
437
|
+
this.addFloatingGroup(removedGroup, {
|
|
438
|
+
height: floatingBox.height,
|
|
439
|
+
width: floatingBox.width,
|
|
440
|
+
position: floatingBox,
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
this.doRemoveGroup(removedGroup, {
|
|
445
|
+
skipDispose: true,
|
|
446
|
+
skipActive: true,
|
|
447
|
+
skipPopoutReturn: true,
|
|
448
|
+
});
|
|
449
|
+
removedGroup.model.renderContainer =
|
|
450
|
+
this.overlayRenderContainer;
|
|
451
|
+
removedGroup.model.location = { type: 'grid' };
|
|
452
|
+
returnedGroup = removedGroup;
|
|
453
|
+
this.movingLock(() => {
|
|
454
|
+
// suppress group add events since the group already exists
|
|
455
|
+
this.doAddGroup(removedGroup, [0]);
|
|
456
|
+
});
|
|
457
|
+
}
|
|
433
458
|
this.doSetGroupAndPanelActive(removedGroup);
|
|
434
459
|
}
|
|
435
460
|
}));
|
|
@@ -779,6 +804,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
779
804
|
locked: !!locked,
|
|
780
805
|
hideHeader: !!hideHeader,
|
|
781
806
|
});
|
|
807
|
+
this._onDidAddGroup.fire(group);
|
|
782
808
|
const createdPanels = [];
|
|
783
809
|
for (const child of views) {
|
|
784
810
|
/**
|
|
@@ -789,7 +815,6 @@ export class DockviewComponent extends BaseGrid {
|
|
|
789
815
|
const panel = this._deserializer.fromJSON(panels[child], group);
|
|
790
816
|
createdPanels.push(panel);
|
|
791
817
|
}
|
|
792
|
-
this._onDidAddGroup.fire(group);
|
|
793
818
|
for (let i = 0; i < views.length; i++) {
|
|
794
819
|
const panel = createdPanels[i];
|
|
795
820
|
const isActive = typeof activeView === 'string' &&
|
|
@@ -1323,9 +1348,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1323
1348
|
}));
|
|
1324
1349
|
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
1325
1350
|
const newGroup = this.createGroupAtLocation(targetLocation);
|
|
1326
|
-
this.movingLock(() => newGroup.model.openPanel(removedPanel
|
|
1327
|
-
skipSetActive: true,
|
|
1328
|
-
}));
|
|
1351
|
+
this.movingLock(() => newGroup.model.openPanel(removedPanel));
|
|
1329
1352
|
this.doSetGroupAndPanelActive(newGroup);
|
|
1330
1353
|
this._onDidMovePanel.fire({
|
|
1331
1354
|
panel: this.getGroupPanel(sourceItemId),
|
|
@@ -215,7 +215,7 @@ export class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
215
215
|
group: this.groupPanel,
|
|
216
216
|
getData: getPanelData,
|
|
217
217
|
}));
|
|
218
|
-
}), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this._onUnhandledDragOverEvent);
|
|
218
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this._onUnhandledDragOverEvent, this._onDidPanelTitleChange, this._onDidPanelParametersChange);
|
|
219
219
|
}
|
|
220
220
|
focusContent() {
|
|
221
221
|
this.contentContainer.element.focus();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CompositeDisposable } from '../lifecycle';
|
|
2
|
+
import { DockviewComponent } from './dockviewComponent';
|
|
3
|
+
export declare class StrictEventsSequencing extends CompositeDisposable {
|
|
4
|
+
private readonly accessor;
|
|
5
|
+
constructor(accessor: DockviewComponent);
|
|
6
|
+
private init;
|
|
7
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { CompositeDisposable } from '../lifecycle';
|
|
2
|
+
export class StrictEventsSequencing extends CompositeDisposable {
|
|
3
|
+
constructor(accessor) {
|
|
4
|
+
super();
|
|
5
|
+
this.accessor = accessor;
|
|
6
|
+
this.init();
|
|
7
|
+
}
|
|
8
|
+
init() {
|
|
9
|
+
const panels = new Set();
|
|
10
|
+
const groups = new Set();
|
|
11
|
+
this.addDisposables(this.accessor.onDidAddPanel((panel) => {
|
|
12
|
+
if (panels.has(panel.api.id)) {
|
|
13
|
+
throw new Error(`dockview: Invalid event sequence. [onDidAddPanel] called for panel ${panel.api.id} but panel already exists`);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
panels.add(panel.api.id);
|
|
17
|
+
}
|
|
18
|
+
}), this.accessor.onDidRemovePanel((panel) => {
|
|
19
|
+
if (!panels.has(panel.api.id)) {
|
|
20
|
+
throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${panel.api.id} but panel does not exists`);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
panels.delete(panel.api.id);
|
|
24
|
+
}
|
|
25
|
+
}), this.accessor.onDidAddGroup((group) => {
|
|
26
|
+
if (groups.has(group.api.id)) {
|
|
27
|
+
throw new Error(`dockview: Invalid event sequence. [onDidAddGroup] called for group ${group.api.id} but group already exists`);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
groups.add(group.api.id);
|
|
31
|
+
}
|
|
32
|
+
}), this.accessor.onDidRemoveGroup((group) => {
|
|
33
|
+
if (!groups.has(group.api.id)) {
|
|
34
|
+
throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${group.api.id} but group does not exists`);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
groups.delete(group.api.id);
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -98,7 +98,7 @@ export class BaseGrid extends Resizable {
|
|
|
98
98
|
this._bufferOnDidLayoutChange.fire();
|
|
99
99
|
}), Event.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
100
100
|
this._bufferOnDidLayoutChange.fire();
|
|
101
|
-
}), this._bufferOnDidLayoutChange);
|
|
101
|
+
}), this._onDidMaximizedChange, this._onDidViewVisibilityChangeMicroTaskQueue, this._bufferOnDidLayoutChange);
|
|
102
102
|
}
|
|
103
103
|
setVisible(panel, visible) {
|
|
104
104
|
this.gridview.setViewVisible(getGridLocation(panel.element), visible);
|