Make addGroup wiithout reference panel/group allow id option

This commit is contained in:
Hieu 2025-02-24 03:03:00 +07:00
parent ab965ca726
commit 6511b8d936
No known key found for this signature in database
GPG Key ID: 048E275886432F81

View File

@ -1100,7 +1100,7 @@ export class DockviewComponent
this.updateWatermark();
}
private orthogonalize(position: Position): DockviewGroupPanel {
private orthogonalize(position: Position, options?: GroupOptions): DockviewGroupPanel {
switch (position) {
case 'top':
case 'bottom':
@ -1126,10 +1126,10 @@ export class DockviewComponent
case 'top':
case 'left':
case 'center':
return this.createGroupAtLocation([0]); // insert into first position
return this.createGroupAtLocation([0], undefined, options); // insert into first position
case 'bottom':
case 'right':
return this.createGroupAtLocation([this.gridview.length]); // insert into last position
return this.createGroupAtLocation([this.gridview.length], undefined, options); // insert into last position
default:
throw new Error(`unsupported position ${position}`);
}
@ -1808,7 +1808,8 @@ export class DockviewComponent
}
} else {
const group = this.orthogonalize(
directionToPosition(<Direction>options.direction)
directionToPosition(<Direction>options.direction),
options
);
if (!options.skipSetActive) {
this.doSetGroupAndPanelActive(group);
@ -2474,9 +2475,10 @@ export class DockviewComponent
private createGroupAtLocation(
location: number[],
size?: number
size?: number,
options?: GroupOptions
): DockviewGroupPanel {
const group = this.createGroup();
const group = this.createGroup(options);
this.doAddGroup(group, location, size);
return group;
}