mirror of
https://github.com/mathuo/dockview
synced 2025-03-10 07:52:07 +00:00
Merge pull request #379 from mathuo/373-fix-sonar-issues
chore: fix sonar issues
This commit is contained in:
commit
8aa0d0192e
@ -15,7 +15,10 @@ import { PanelTransfer } from '../dnd/dataTransfer';
|
|||||||
import { IDisposable } from '../lifecycle';
|
import { IDisposable } from '../lifecycle';
|
||||||
import { Position } from '../dnd/droptarget';
|
import { Position } from '../dnd/droptarget';
|
||||||
import { IDockviewPanel } from './dockviewPanel';
|
import { IDockviewPanel } from './dockviewPanel';
|
||||||
import { FrameworkFactory } from '../panel/componentFactory';
|
import {
|
||||||
|
ComponentConstructor,
|
||||||
|
FrameworkFactory,
|
||||||
|
} from '../panel/componentFactory';
|
||||||
import { DockviewGroupPanelApi } from '../api/dockviewGroupPanelApi';
|
import { DockviewGroupPanelApi } from '../api/dockviewGroupPanelApi';
|
||||||
|
|
||||||
export interface IHeaderActionsRenderer extends IDisposable {
|
export interface IHeaderActionsRenderer extends IDisposable {
|
||||||
@ -40,14 +43,10 @@ export interface TabContextMenuEvent {
|
|||||||
|
|
||||||
export interface DockviewRenderFunctions {
|
export interface DockviewRenderFunctions {
|
||||||
tabComponents?: {
|
tabComponents?: {
|
||||||
[componentName: string]: {
|
[componentName: string]: ComponentConstructor<ITabRenderer>;
|
||||||
new (id: string, component: string): ITabRenderer;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
components?: {
|
components?: {
|
||||||
[componentName: string]: {
|
[componentName: string]: ComponentConstructor<IContentRenderer>;
|
||||||
new (id: string, component: string): IContentRenderer;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
frameworkTabComponents?: {
|
frameworkTabComponents?: {
|
||||||
[componentName: string]: any;
|
[componentName: string]: any;
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import { GridviewPanel } from './gridviewPanel';
|
import { GridviewPanel } from './gridviewPanel';
|
||||||
import { ISplitviewStyles, Orientation } from '../splitview/splitview';
|
import { ISplitviewStyles, Orientation } from '../splitview/splitview';
|
||||||
import { FrameworkFactory } from '../panel/componentFactory';
|
import {
|
||||||
|
ComponentConstructor,
|
||||||
|
FrameworkFactory,
|
||||||
|
} from '../panel/componentFactory';
|
||||||
|
|
||||||
export interface GridviewComponentOptions {
|
export interface GridviewComponentOptions {
|
||||||
disableAutoResizing?: boolean;
|
disableAutoResizing?: boolean;
|
||||||
proportionalLayout: boolean;
|
proportionalLayout: boolean;
|
||||||
orientation: Orientation;
|
orientation: Orientation;
|
||||||
components?: {
|
components?: {
|
||||||
[componentName: string]: {
|
[componentName: string]: ComponentConstructor<GridviewPanel>;
|
||||||
new (id: string, componentName: string): GridviewPanel;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
frameworkComponents?: {
|
frameworkComponents?: {
|
||||||
[componentName: string]: any;
|
[componentName: string]: any;
|
||||||
|
@ -2,11 +2,15 @@ export interface FrameworkFactory<T> {
|
|||||||
createComponent: (id: string, componentId: string, component: any) => T;
|
createComponent: (id: string, componentId: string, component: any) => T;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ComponentConstructor<T> = {
|
||||||
|
new (id: string, component: string): T;
|
||||||
|
};
|
||||||
|
|
||||||
export function createComponent<T>(
|
export function createComponent<T>(
|
||||||
id: string,
|
id: string,
|
||||||
componentName?: string,
|
componentName?: string,
|
||||||
components: {
|
components: {
|
||||||
[componentName: string]: { new (id: string, component: string): T };
|
[componentName: string]: ComponentConstructor<T>;
|
||||||
} = {},
|
} = {},
|
||||||
frameworkComponents: {
|
frameworkComponents: {
|
||||||
[componentName: string]: any;
|
[componentName: string]: any;
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
import { FrameworkFactory } from '../panel/componentFactory';
|
import {
|
||||||
|
ComponentConstructor,
|
||||||
|
FrameworkFactory,
|
||||||
|
} from '../panel/componentFactory';
|
||||||
import { PaneviewDndOverlayEvent } from './paneviewComponent';
|
import { PaneviewDndOverlayEvent } from './paneviewComponent';
|
||||||
import { IPaneBodyPart, IPaneHeaderPart, PaneviewPanel } from './paneviewPanel';
|
import { IPaneBodyPart, IPaneHeaderPart, PaneviewPanel } from './paneviewPanel';
|
||||||
|
|
||||||
export interface PaneviewComponentOptions {
|
export interface PaneviewComponentOptions {
|
||||||
disableAutoResizing?: boolean;
|
disableAutoResizing?: boolean;
|
||||||
components?: {
|
components?: {
|
||||||
[componentName: string]: {
|
[componentName: string]: ComponentConstructor<PaneviewPanel>;
|
||||||
new (id: string, componentName: string): PaneviewPanel;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
frameworkComponents?: {
|
frameworkComponents?: {
|
||||||
[componentName: string]: any;
|
[componentName: string]: any;
|
||||||
};
|
};
|
||||||
headerComponents?: {
|
headerComponents?: {
|
||||||
[componentName: string]: {
|
[componentName: string]: ComponentConstructor<PaneviewPanel>;
|
||||||
new (id: string, componentName: string): PaneviewPanel;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
headerframeworkComponents?: {
|
headerframeworkComponents?: {
|
||||||
[componentName: string]: any;
|
[componentName: string]: any;
|
||||||
|
@ -19,7 +19,7 @@ export class Paneview extends CompositeDisposable implements IDisposable {
|
|||||||
private splitview: Splitview;
|
private splitview: Splitview;
|
||||||
private paneItems: PaneItem[] = [];
|
private paneItems: PaneItem[] = [];
|
||||||
private _orientation: Orientation;
|
private _orientation: Orientation;
|
||||||
private animationTimer: any | undefined;
|
private animationTimer: any;
|
||||||
private skipAnimation = false;
|
private skipAnimation = false;
|
||||||
|
|
||||||
private readonly _onDidChange = new Emitter<void>();
|
private readonly _onDidChange = new Emitter<void>();
|
||||||
|
@ -87,7 +87,7 @@ export abstract class PaneviewPanel
|
|||||||
private bodyPart?: IPaneHeaderPart;
|
private bodyPart?: IPaneHeaderPart;
|
||||||
private headerPart?: IPaneBodyPart;
|
private headerPart?: IPaneBodyPart;
|
||||||
private expandedSize = 0;
|
private expandedSize = 0;
|
||||||
private animationTimer: any | undefined;
|
private animationTimer: any;
|
||||||
private _orientation: Orientation;
|
private _orientation: Orientation;
|
||||||
|
|
||||||
private _headerVisible: boolean;
|
private _headerVisible: boolean;
|
||||||
|
@ -2,7 +2,10 @@ import { IPanel, PanelInitParameters } from '../panel/types';
|
|||||||
import { IView, SplitViewOptions, LayoutPriority } from './splitview';
|
import { IView, SplitViewOptions, LayoutPriority } from './splitview';
|
||||||
import { SplitviewPanel } from './splitviewPanel';
|
import { SplitviewPanel } from './splitviewPanel';
|
||||||
import { SplitviewComponent } from './splitviewComponent';
|
import { SplitviewComponent } from './splitviewComponent';
|
||||||
import { FrameworkFactory } from '../panel/componentFactory';
|
import {
|
||||||
|
ComponentConstructor,
|
||||||
|
FrameworkFactory,
|
||||||
|
} from '../panel/componentFactory';
|
||||||
|
|
||||||
export interface PanelViewInitParameters extends PanelInitParameters {
|
export interface PanelViewInitParameters extends PanelInitParameters {
|
||||||
minimumSize?: number;
|
minimumSize?: number;
|
||||||
@ -19,9 +22,7 @@ export interface ISerializableView extends IView, IPanel {
|
|||||||
export interface SplitviewComponentOptions extends SplitViewOptions {
|
export interface SplitviewComponentOptions extends SplitViewOptions {
|
||||||
disableAutoResizing?: boolean;
|
disableAutoResizing?: boolean;
|
||||||
components?: {
|
components?: {
|
||||||
[componentName: string]: {
|
[componentName: string]: ComponentConstructor<SplitviewPanel>;
|
||||||
new (id: string, componentName: string): SplitviewPanel;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
frameworkComponents?: {
|
frameworkComponents?: {
|
||||||
[componentName: string]: any;
|
[componentName: string]: any;
|
||||||
|
@ -274,7 +274,7 @@ export class SplitviewComponent
|
|||||||
view.orientation = this.splitview.orientation;
|
view.orientation = this.splitview.orientation;
|
||||||
|
|
||||||
view.init({
|
view.init({
|
||||||
params: options.params || {},
|
params: options.params ?? {},
|
||||||
minimumSize: options.minimumSize,
|
minimumSize: options.minimumSize,
|
||||||
maximumSize: options.maximumSize,
|
maximumSize: options.maximumSize,
|
||||||
snap: options.snap,
|
snap: options.snap,
|
||||||
|
@ -194,7 +194,7 @@ export const usePortalsLifecycle: PortalLifecycleHook = () => {
|
|||||||
|
|
||||||
// it does the job...
|
// it does the job...
|
||||||
export function isReactElement(
|
export function isReactElement(
|
||||||
element: any | React.ReactElement
|
element: unknown
|
||||||
): element is React.ReactElement {
|
): element is React.ReactElement {
|
||||||
return element?.type;
|
return !!(element as React.ReactElement)?.type;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user