This commit is contained in:
mathuo 2024-12-22 19:20:06 +00:00
commit bdf81fd5b5
No known key found for this signature in database
GPG Key ID: C6EEDEFD6CA07281
2 changed files with 30 additions and 15 deletions

View File

@ -5052,8 +5052,13 @@ describe('dockviewComponent', () => {
component: 'default', component: 'default',
}); });
await dockview.addPopoutGroup(panel2); const panel3 = dockview.addPanel({
id: 'panel_3',
component: 'default',
renderer: 'always',
});
await dockview.addPopoutGroup(panel2);
panel2.api.moveTo({ group: panel1.api.group, position: 'right' }); panel2.api.moveTo({ group: panel1.api.group, position: 'right' });
// confirm panel is rendered on DOM // confirm panel is rendered on DOM
@ -5062,6 +5067,22 @@ describe('dockviewComponent', () => {
'.dv-content-container > .testpanel-panel_2' '.dv-content-container > .testpanel-panel_2'
).length ).length
).toBe(1); ).toBe(1);
await dockview.addPopoutGroup(panel3);
panel3.api.moveTo({ group: panel1.api.group, position: 'right' });
// confirm panel is rendered to always overlay container
expect(
dockview.element.querySelectorAll(
'.dv-render-overlay > .testpanel-panel_3'
).length
).toBe(1);
expect(
panel2.group.element.querySelectorAll(
'.dv-content-container > .testpanel-panel_3'
).length
).toBe(0);
expect(dockview.element);
}); });
test('move popout group of 1 panel inside grid', async () => { test('move popout group of 1 panel inside grid', async () => {

View File

@ -577,11 +577,6 @@ export class DockviewComponent
this.updateWatermark(); this.updateWatermark();
} }
override dispose(): void {
this.clear(); // explicitly clear the layout before cleaning up
super.dispose();
}
override setVisible(panel: DockviewGroupPanel, visible: boolean): void { override setVisible(panel: DockviewGroupPanel, visible: boolean): void {
switch (panel.api.location.type) { switch (panel.api.location.type) {
case 'grid': case 'grid':
@ -847,32 +842,31 @@ export class DockviewComponent
}); });
} }
} else if (this.getPanel(group.id)) { } else if (this.getPanel(group.id)) {
const removedGroup = group; group.model.renderContainer =
this.overlayRenderContainer;
returnedGroup = group;
if (floatingBox) { if (floatingBox) {
this.addFloatingGroup(removedGroup, { this.addFloatingGroup(group, {
height: floatingBox.height, height: floatingBox.height,
width: floatingBox.width, width: floatingBox.width,
position: floatingBox, position: floatingBox,
}); });
} else { } else {
this.doRemoveGroup(removedGroup, { this.doRemoveGroup(group, {
skipDispose: true, skipDispose: true,
skipActive: true, skipActive: true,
skipPopoutReturn: true, skipPopoutReturn: true,
}); });
removedGroup.model.renderContainer = group.model.location = { type: 'grid' };
this.overlayRenderContainer;
removedGroup.model.location = { type: 'grid' };
returnedGroup = removedGroup;
this.movingLock(() => { this.movingLock(() => {
// suppress group add events since the group already exists // suppress group add events since the group already exists
this.doAddGroup(removedGroup, [0]); this.doAddGroup(group, [0]);
}); });
} }
this.doSetGroupAndPanelActive(removedGroup); this.doSetGroupAndPanelActive(group);
} }
}) })
); );