mirror of
https://github.com/mathuo/dockview
synced 2025-05-01 09:08:24 +00:00
chore: fix sonar issues
This commit is contained in:
parent
318cbd6854
commit
882c1353c7
@ -1,8 +1,4 @@
|
||||
class TransferObject {
|
||||
constructor() {
|
||||
//
|
||||
}
|
||||
}
|
||||
class TransferObject {}
|
||||
|
||||
export class PanelTransfer extends TransferObject {
|
||||
constructor(
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { toHaveDescription } from '@testing-library/jest-dom/matchers';
|
||||
import {
|
||||
getElementsByTagName,
|
||||
quasiDefaultPrevented,
|
||||
|
@ -35,7 +35,7 @@ export class DefaultDockviewDeserialzier implements IPanelDeserializer {
|
||||
|
||||
const contentComponent = viewData
|
||||
? viewData.content.id
|
||||
: panelData.contentComponent || 'unknown';
|
||||
: panelData.contentComponent ?? 'unknown';
|
||||
const tabComponent = viewData
|
||||
? viewData.tab?.id
|
||||
: panelData.tabComponent;
|
||||
@ -56,8 +56,8 @@ export class DefaultDockviewDeserialzier implements IPanelDeserializer {
|
||||
);
|
||||
|
||||
panel.init({
|
||||
title: title || panelId,
|
||||
params: params || {},
|
||||
title: title ?? panelId,
|
||||
params: params ?? {},
|
||||
});
|
||||
|
||||
return panel;
|
||||
|
@ -55,7 +55,6 @@ import {
|
||||
GroupDragEvent,
|
||||
TabDragEvent,
|
||||
} from './components/titlebar/tabsContainer';
|
||||
import { DockviewGroupPanelApi } from '../api/dockviewGroupPanelApi';
|
||||
|
||||
const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
||||
|
||||
@ -303,7 +302,7 @@ export class DockviewComponent
|
||||
constructor(options: DockviewComponentOptions) {
|
||||
super({
|
||||
proportionalLayout: true,
|
||||
orientation: options.orientation || Orientation.HORIZONTAL,
|
||||
orientation: options.orientation ?? Orientation.HORIZONTAL,
|
||||
styles: options.styles,
|
||||
parentElement: options.parentElement,
|
||||
});
|
||||
@ -407,7 +406,7 @@ export class DockviewComponent
|
||||
this.moveGroupOrPanel(
|
||||
this.orthogonalize(event.position),
|
||||
data.groupId,
|
||||
data.panelId || undefined,
|
||||
data.panelId ?? undefined,
|
||||
'center'
|
||||
);
|
||||
} else {
|
||||
@ -1214,7 +1213,7 @@ export class DockviewComponent
|
||||
|
||||
if (!destinationTarget || destinationTarget === 'center') {
|
||||
const groupItem: IDockviewPanel | undefined =
|
||||
sourceGroup?.model.removePanel(sourceItemId) ||
|
||||
sourceGroup?.model.removePanel(sourceItemId) ??
|
||||
this.panels.find((panel) => panel.id === sourceItemId);
|
||||
|
||||
if (!groupItem) {
|
||||
@ -1278,7 +1277,7 @@ export class DockviewComponent
|
||||
this.doAddGroup(targetGroup, location);
|
||||
} else {
|
||||
const groupItem: IDockviewPanel | undefined =
|
||||
sourceGroup?.model.removePanel(sourceItemId) ||
|
||||
sourceGroup?.model.removePanel(sourceItemId) ??
|
||||
this.panels.find((panel) => panel.id === sourceItemId);
|
||||
|
||||
if (!groupItem) {
|
||||
@ -1431,7 +1430,7 @@ export class DockviewComponent
|
||||
): DockviewPanel {
|
||||
const contentComponent = options.component;
|
||||
const tabComponent =
|
||||
options.tabComponent || this.options.defaultTabComponent;
|
||||
options.tabComponent ?? this.options.defaultTabComponent;
|
||||
|
||||
const view = new DockviewPanelModel(
|
||||
this,
|
||||
@ -1448,8 +1447,8 @@ export class DockviewComponent
|
||||
view
|
||||
);
|
||||
panel.init({
|
||||
title: options.title || options.id,
|
||||
params: options?.params || {},
|
||||
title: options.title ?? options.id,
|
||||
params: options?.params ?? {},
|
||||
});
|
||||
|
||||
return panel;
|
||||
|
@ -322,7 +322,7 @@ export class DockviewGroupPanelModel
|
||||
);
|
||||
|
||||
this.header.hidden = !!options.hideHeader;
|
||||
this.locked = options.locked || false;
|
||||
this.locked = options.locked ?? false;
|
||||
|
||||
this.addDisposables(
|
||||
this._onTabDragStart,
|
||||
|
@ -117,7 +117,7 @@ export class DockviewPanel
|
||||
public update(event: PanelUpdateEvent): void {
|
||||
// merge the new parameters with the existing parameters
|
||||
this._params = {
|
||||
...(this._params || {}),
|
||||
...(this._params ?? {}),
|
||||
...event.params,
|
||||
};
|
||||
|
||||
|
@ -97,7 +97,7 @@ export class DockviewPanelModel implements IDockviewPanelModel {
|
||||
return createComponent(
|
||||
id,
|
||||
componentName,
|
||||
this.accessor.options.components || {},
|
||||
this.accessor.options.components ?? {},
|
||||
this.accessor.options.frameworkComponents,
|
||||
this.accessor.options.frameworkComponentFactory?.content
|
||||
);
|
||||
|
@ -281,7 +281,7 @@ export abstract class BaseGrid<T extends IGridPanelView>
|
||||
|
||||
public layout(width: number, height: number, forceResize?: boolean): void {
|
||||
const different =
|
||||
forceResize || width !== this.width || height !== this.height;
|
||||
forceResize ?? (width !== this.width || height !== this.height);
|
||||
|
||||
if (!different) {
|
||||
return;
|
||||
|
@ -190,8 +190,8 @@ export class GridviewComponent
|
||||
const view = createComponent(
|
||||
data.id,
|
||||
data.component,
|
||||
this.options.components || {},
|
||||
this.options.frameworkComponents || {},
|
||||
this.options.components ?? {},
|
||||
this.options.frameworkComponents ?? {},
|
||||
this.options.frameworkComponentFactory
|
||||
? {
|
||||
createComponent:
|
||||
@ -308,7 +308,7 @@ export class GridviewComponent
|
||||
public addPanel<T extends object = Parameters>(
|
||||
options: AddComponentOptions<T>
|
||||
): IGridviewPanel {
|
||||
let relativeLocation: number[] = options.location || [0];
|
||||
let relativeLocation: number[] = options.location ?? [0];
|
||||
|
||||
if (options.position?.referencePanel) {
|
||||
const referenceGroup = this._groups.get(
|
||||
@ -337,8 +337,8 @@ export class GridviewComponent
|
||||
const view = createComponent(
|
||||
options.id,
|
||||
options.component,
|
||||
this.options.components || {},
|
||||
this.options.frameworkComponents || {},
|
||||
this.options.components ?? {},
|
||||
this.options.frameworkComponents ?? {},
|
||||
this.options.frameworkComponentFactory
|
||||
? {
|
||||
createComponent:
|
||||
@ -349,7 +349,7 @@ export class GridviewComponent
|
||||
);
|
||||
|
||||
view.init({
|
||||
params: options.params || {},
|
||||
params: options.params ?? {},
|
||||
minimumWidth: options.minimumWidth,
|
||||
maximumWidth: options.maximumWidth,
|
||||
minimumHeight: options.minimumHeight,
|
||||
|
@ -240,8 +240,8 @@ export class PaneviewComponent extends Resizable implements IPaneviewComponent {
|
||||
const body = createComponent(
|
||||
options.id,
|
||||
options.component,
|
||||
this.options.components || {},
|
||||
this.options.frameworkComponents || {},
|
||||
this.options.components ?? {},
|
||||
this.options.frameworkComponents ?? {},
|
||||
this.options.frameworkWrapper
|
||||
? {
|
||||
createComponent:
|
||||
@ -256,7 +256,7 @@ export class PaneviewComponent extends Resizable implements IPaneviewComponent {
|
||||
header = createComponent(
|
||||
options.id,
|
||||
options.headerComponent,
|
||||
this.options.headerComponents || {},
|
||||
this.options.headerComponents ?? {},
|
||||
this.options.headerframeworkComponents,
|
||||
this.options.frameworkWrapper
|
||||
? {
|
||||
@ -290,7 +290,7 @@ export class PaneviewComponent extends Resizable implements IPaneviewComponent {
|
||||
typeof options.index === 'number' ? options.index : undefined;
|
||||
|
||||
view.init({
|
||||
params: options.params || {},
|
||||
params: options.params ?? {},
|
||||
minimumBodySize: options.minimumBodySize,
|
||||
maximumBodySize: options.maximumBodySize,
|
||||
isExpanded: options.isExpanded,
|
||||
@ -377,8 +377,8 @@ export class PaneviewComponent extends Resizable implements IPaneviewComponent {
|
||||
const body = createComponent(
|
||||
data.id,
|
||||
data.component,
|
||||
this.options.components || {},
|
||||
this.options.frameworkComponents || {},
|
||||
this.options.components ?? {},
|
||||
this.options.frameworkComponents ?? {},
|
||||
this.options.frameworkWrapper
|
||||
? {
|
||||
createComponent:
|
||||
@ -394,8 +394,8 @@ export class PaneviewComponent extends Resizable implements IPaneviewComponent {
|
||||
header = createComponent(
|
||||
data.id,
|
||||
data.headerComponent,
|
||||
this.options.headerComponents || {},
|
||||
this.options.headerframeworkComponents || {},
|
||||
this.options.headerComponents ?? {},
|
||||
this.options.headerframeworkComponents ?? {},
|
||||
this.options.frameworkWrapper
|
||||
? {
|
||||
createComponent:
|
||||
@ -424,7 +424,7 @@ export class PaneviewComponent extends Resizable implements IPaneviewComponent {
|
||||
|
||||
queue.push(() => {
|
||||
panel.init({
|
||||
params: data.params || {},
|
||||
params: data.params ?? {},
|
||||
minimumBodySize: view.minimumSize,
|
||||
maximumBodySize: view.maximumSize,
|
||||
title: data.title,
|
||||
|
@ -261,8 +261,8 @@ export class SplitviewComponent
|
||||
const view = createComponent(
|
||||
options.id,
|
||||
options.component,
|
||||
this.options.components || {},
|
||||
this.options.frameworkComponents || {},
|
||||
this.options.components ?? {},
|
||||
this.options.frameworkComponents ?? {},
|
||||
this.options.frameworkWrapper
|
||||
? {
|
||||
createComponent:
|
||||
@ -361,8 +361,8 @@ export class SplitviewComponent
|
||||
const panel = createComponent(
|
||||
data.id,
|
||||
data.component,
|
||||
this.options.components || {},
|
||||
this.options.frameworkComponents || {},
|
||||
this.options.components ?? {},
|
||||
this.options.frameworkComponents ?? {},
|
||||
this.options.frameworkWrapper
|
||||
? {
|
||||
createComponent:
|
||||
@ -374,7 +374,7 @@ export class SplitviewComponent
|
||||
|
||||
queue.push(() => {
|
||||
panel.init({
|
||||
params: data.params || {},
|
||||
params: data.params ?? {},
|
||||
minimumSize: data.minimumSize,
|
||||
maximumSize: data.maximumSize,
|
||||
snap: view.snap,
|
||||
|
@ -7,7 +7,6 @@ import { SplitviewPanelApiImpl } from '../api/splitviewPanelApi';
|
||||
import { LayoutPriority, Orientation } from './splitview';
|
||||
import { FunctionOrValue } from '../types';
|
||||
import { Emitter, Event } from '../events';
|
||||
import { CompositeDisposable } from '../lifecycle';
|
||||
|
||||
export interface ISplitviewPanel
|
||||
extends BasePanelViewExported<SplitviewPanelApiImpl> {
|
||||
|
@ -139,7 +139,7 @@ export const DockviewReact = React.forwardRef(
|
||||
},
|
||||
};
|
||||
|
||||
const frameworkTabComponents = props.tabComponents || {};
|
||||
const frameworkTabComponents = props.tabComponents ?? {};
|
||||
|
||||
if (props.defaultTabComponent) {
|
||||
frameworkTabComponents[DEFAULT_REACT_TAB] =
|
||||
@ -267,7 +267,7 @@ export const DockviewReact = React.forwardRef(
|
||||
return;
|
||||
}
|
||||
|
||||
const frameworkTabComponents = props.tabComponents || {};
|
||||
const frameworkTabComponents = props.tabComponents ?? {};
|
||||
|
||||
if (props.defaultTabComponent) {
|
||||
frameworkTabComponents[DEFAULT_REACT_TAB] =
|
||||
|
@ -60,7 +60,7 @@ export class ReactWatermarkPart implements IWatermarkRenderer {
|
||||
this.parameters.params = params.params;
|
||||
}
|
||||
|
||||
this.part?.update({ params: this.parameters?.params || {} });
|
||||
this.part?.update({ params: this.parameters?.params ?? {} });
|
||||
}
|
||||
|
||||
layout(_width: number, _height: number): void {
|
||||
|
@ -51,7 +51,7 @@ export const GridviewReact = React.forwardRef(
|
||||
typeof props.proportionalLayout === 'boolean'
|
||||
? props.proportionalLayout
|
||||
: true,
|
||||
orientation: props.orientation || Orientation.HORIZONTAL,
|
||||
orientation: props.orientation ?? Orientation.HORIZONTAL,
|
||||
frameworkComponents: props.components,
|
||||
frameworkComponentFactory: {
|
||||
createComponent: (id: string, componentId, component) => {
|
||||
|
@ -23,7 +23,7 @@ export class ReactGridPanelView extends GridviewPanel {
|
||||
this.reactPortalStore,
|
||||
this.reactComponent,
|
||||
{
|
||||
params: this._params?.params || {},
|
||||
params: this._params?.params ?? {},
|
||||
api: this.api,
|
||||
containerApi: new GridviewApi(
|
||||
(this._params as GridviewInitParameters).accessor
|
||||
|
@ -41,7 +41,7 @@ export const SplitviewReact = React.forwardRef(
|
||||
React.useEffect(() => {
|
||||
const splitview = new SplitviewComponent({
|
||||
parentElement: domRef.current!,
|
||||
orientation: props.orientation || Orientation.HORIZONTAL,
|
||||
orientation: props.orientation ?? Orientation.HORIZONTAL,
|
||||
frameworkComponents: props.components,
|
||||
frameworkWrapper: {
|
||||
createComponent: (
|
||||
|
@ -22,7 +22,7 @@ export class ReactPanelView extends SplitviewPanel {
|
||||
this.reactPortalStore,
|
||||
this.reactComponent,
|
||||
{
|
||||
params: this._params?.params || {},
|
||||
params: this._params?.params ?? {},
|
||||
api: this.api,
|
||||
containerApi: new SplitviewApi(
|
||||
(this._params as PanelViewInitParameters).accessor
|
||||
|
Loading…
Reference in New Issue
Block a user