Skip to content

Commit

Permalink
chore: sonarcloud requests
Browse files Browse the repository at this point in the history
  • Loading branch information
mathuo committed May 13, 2024
1 parent 35630e4 commit c4ab6ac
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 33 deletions.
15 changes: 8 additions & 7 deletions packages/dockview-core/src/api/dockviewPanelApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,14 @@ export class DockviewPanelApiImpl

this.groupEventsDisposable.value = new CompositeDisposable(
this.group.api.onDidVisibilityChange((event) => {
if (!event.isVisible && this.isVisible) {
this._onDidVisibilityChange.fire(event);
} else if (
event.isVisible &&
!this.isVisible &&
this.group.model.isPanelActive(this.panel)
) {
const hasBecomeHidden = !event.isVisible && this.isVisible;
const hasBecomeVisible = event.isVisible && !this.isVisible;

const isActivePanel = this.group.model.isPanelActive(
this.panel
);

if (hasBecomeHidden || (hasBecomeVisible && isActivePanel)) {
this._onDidVisibilityChange.fire(event);
}
}),
Expand Down
6 changes: 5 additions & 1 deletion packages/dockview-core/src/dnd/dataTransfer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
class TransferObject {}
class TransferObject {
constructor() {
// intentionally empty class
}
}

export class PanelTransfer extends TransferObject {
constructor(
Expand Down
25 changes: 11 additions & 14 deletions packages/dockview-core/src/dockview/dockviewComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ export class DockviewComponent
const box: Box = getBox();

const groupId =
options?.overridePopoutGroup?.id ?? this.getNextGroupId(); //item.id;
options?.overridePopoutGroup?.id ?? this.getNextGroupId();

if (itemToPopout.api.location.type === 'grid') {
itemToPopout.api.setVisible(false);
Expand Down Expand Up @@ -811,17 +811,15 @@ export class DockviewComponent
skipPopoutAssociated: true,
});
}
} else {
if (this.getPanel(group.id)) {
const removedGroup = this.doRemoveGroup(group, {
skipDispose: true,
skipActive: true,
});
removedGroup.model.renderContainer =
this.overlayRenderContainer;
removedGroup.model.location = { type: 'grid' };
returnedGroup = removedGroup;
}
} else if (this.getPanel(group.id)) {
const removedGroup = this.doRemoveGroup(group, {
skipDispose: true,
skipActive: true,
});
removedGroup.model.renderContainer =
this.overlayRenderContainer;
removedGroup.model.location = { type: 'grid' };
returnedGroup = removedGroup;
}
})
);
Expand Down Expand Up @@ -894,7 +892,7 @@ export class DockviewComponent
this.doRemoveGroup(item, {
skipDispose: true,
skipPopoutReturn: true,
skipPopoutAssociated: !!popoutReferenceGroup,
skipPopoutAssociated: false,
});
}
}
Expand Down Expand Up @@ -1372,7 +1370,6 @@ export class DockviewComponent
const groups = Array.from(this._groups.values()).map((_) => _.value);

const hasActiveGroup = !!this.activeGroup;
const hasActivePanel = !!this.activePanel;

for (const group of groups) {
// remove the group will automatically remove the panels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ export class DockviewGroupPanelModel
target,
position,
getPanelData,
this.accessor.getPanel(this.id)!
this.accessor.getPanel(this.id)
);

this._onUnhandledDragOverEvent.fire(firedEvent);
Expand Down
17 changes: 7 additions & 10 deletions packages/dockview/src/dockview/dockview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,12 @@ export interface IDockviewReactProps extends DockviewOptions {
}

function extractCoreOptions(props: IDockviewReactProps): DockviewOptions {
const coreOptions = (PROPERTY_KEYS as (keyof DockviewOptions)[]).reduce(
(obj, key) => {
if (key in props) {
obj[key] = props[key] as any;
}
return obj;
},
{} as Partial<DockviewComponentOptions>
);
const coreOptions = PROPERTY_KEYS.reduce((obj, key) => {
if (key in props) {
obj[key] = props[key] as any;
}
return obj;
}, {} as Partial<DockviewComponentOptions>);

return coreOptions as DockviewOptions;
}
Expand All @@ -91,7 +88,7 @@ export const DockviewReact = React.forwardRef(
const changes: Partial<DockviewOptions> = {};

PROPERTY_KEYS.forEach((propKey) => {
const key = propKey as keyof DockviewOptions;
const key = propKey;
const propValue = props[key];

if (key in props && propValue !== prevProps.current[key]) {
Expand Down

0 comments on commit c4ab6ac

Please sign in to comment.