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