mirror of
https://github.com/mathuo/dockview
synced 2025-10-07 00:18:19 +00:00
feat: extract custom react props into seperate prop variable
This commit is contained in:
parent
2c02bed5d0
commit
9060ff1a55
@ -11,28 +11,33 @@ import { DockviewPanelApi } from '../../api/groupPanelApi';
|
|||||||
import { usePortalsLifecycle } from '../react';
|
import { usePortalsLifecycle } from '../react';
|
||||||
import { DockviewApi } from '../../api/component.api';
|
import { DockviewApi } from '../../api/component.api';
|
||||||
import { ReactWatermarkPart } from './reactWatermarkPart';
|
import { ReactWatermarkPart } from './reactWatermarkPart';
|
||||||
import { PanelCollection } from '../types';
|
import { PanelCollection, PanelParameters } from '../types';
|
||||||
import { watchElementResize } from '../../dom';
|
import { watchElementResize } from '../../dom';
|
||||||
import { IContentRenderer, ITabRenderer } from '../../groupview/types';
|
import { IContentRenderer, ITabRenderer } from '../../groupview/types';
|
||||||
|
|
||||||
export interface IGroupPanelBaseProps {
|
export interface PanelCollection1<T extends IDockviewPanelProps> {
|
||||||
api: DockviewPanelApi;
|
[name: string]: React.FunctionComponent<T>;
|
||||||
containerApi: DockviewApi;
|
|
||||||
[key: string]: any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDockviewPanelProps extends IGroupPanelBaseProps {
|
export interface IGroupPanelBaseProps<T extends {} = Record<string, any>>
|
||||||
[key: string]: any;
|
extends PanelParameters<T> {
|
||||||
|
api: DockviewPanelApi;
|
||||||
|
containerApi: DockviewApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IDockviewPanelProps<T extends {} = Record<string, any>>
|
||||||
|
extends IGroupPanelBaseProps<T> {
|
||||||
|
// noop
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DockviewReadyEvent {
|
export interface DockviewReadyEvent {
|
||||||
api: DockviewApi;
|
api: DockviewApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IWatermarkPanelProps {
|
export interface IWatermarkPanelProps<T extends {} = Record<string, any>>
|
||||||
|
extends PanelParameters<T> {
|
||||||
containerApi: DockviewApi;
|
containerApi: DockviewApi;
|
||||||
close(): void;
|
close(): void;
|
||||||
[key: string]: any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDockviewReactProps {
|
export interface IDockviewReactProps {
|
||||||
|
@ -102,7 +102,7 @@ export class ReactPanelContentPart implements IContentRenderer {
|
|||||||
this.reactPortalStore,
|
this.reactPortalStore,
|
||||||
this.component,
|
this.component,
|
||||||
{
|
{
|
||||||
...parameters.params,
|
params: parameters.params,
|
||||||
api: parameters.api,
|
api: parameters.api,
|
||||||
containerApi: parameters.containerApi,
|
containerApi: parameters.containerApi,
|
||||||
},
|
},
|
||||||
|
@ -37,7 +37,7 @@ export class ReactPanelHeaderPart implements ITabRenderer {
|
|||||||
this.reactPortalStore,
|
this.reactPortalStore,
|
||||||
this.component,
|
this.component,
|
||||||
{
|
{
|
||||||
...parameters.params,
|
params: parameters.params,
|
||||||
api: parameters.api,
|
api: parameters.api,
|
||||||
containerApi: parameters.containerApi,
|
containerApi: parameters.containerApi,
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ export class ReactWatermarkPart implements WatermarkPart {
|
|||||||
this.reactPortalStore,
|
this.reactPortalStore,
|
||||||
this.component,
|
this.component,
|
||||||
{
|
{
|
||||||
...parameters.params,
|
params: parameters.params,
|
||||||
api: parameters.api,
|
api: parameters.api,
|
||||||
containerApi: parameters.containerApi,
|
containerApi: parameters.containerApi,
|
||||||
close: () => {
|
close: () => {
|
||||||
|
@ -67,10 +67,9 @@ export class ReactContentRenderer implements IContentRenderer {
|
|||||||
this.reactPortalStore,
|
this.reactPortalStore,
|
||||||
this.component,
|
this.component,
|
||||||
{
|
{
|
||||||
...parameters.params,
|
params: parameters.params,
|
||||||
api: parameters.api,
|
api: parameters.api,
|
||||||
containerApi: parameters.containerApi,
|
containerApi: parameters.containerApi,
|
||||||
setActionsbar: () => null as any,
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -8,17 +8,17 @@ import { Orientation } from '../../splitview/core/splitview';
|
|||||||
import { ReactGridPanelView } from './view';
|
import { ReactGridPanelView } from './view';
|
||||||
import { usePortalsLifecycle } from '../react';
|
import { usePortalsLifecycle } from '../react';
|
||||||
import { GridviewApi } from '../../api/component.api';
|
import { GridviewApi } from '../../api/component.api';
|
||||||
import { PanelCollection } from '../types';
|
import { PanelCollection, PanelParameters } from '../types';
|
||||||
import { watchElementResize } from '../../dom';
|
import { watchElementResize } from '../../dom';
|
||||||
|
|
||||||
export interface GridviewReadyEvent {
|
export interface GridviewReadyEvent {
|
||||||
api: GridviewApi;
|
api: GridviewApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IGridviewPanelProps {
|
export interface IGridviewPanelProps<T extends {} = Record<string, any>>
|
||||||
|
extends PanelParameters<T> {
|
||||||
api: GridviewPanelApi;
|
api: GridviewPanelApi;
|
||||||
containerApi: GridviewApi;
|
containerApi: GridviewApi;
|
||||||
[key: string]: any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IGridviewReactProps {
|
export interface IGridviewReactProps {
|
||||||
|
@ -21,7 +21,7 @@ export class ReactGridPanelView extends GridviewPanel {
|
|||||||
this.reactPortalStore,
|
this.reactPortalStore,
|
||||||
this.reactComponent,
|
this.reactComponent,
|
||||||
{
|
{
|
||||||
...(this.params?.params || {}),
|
params: this.params?.params || {},
|
||||||
api: this.api,
|
api: this.api,
|
||||||
containerApi: (this.params as GridviewInitParameters)
|
containerApi: (this.params as GridviewInitParameters)
|
||||||
.containerApi,
|
.containerApi,
|
||||||
|
@ -7,18 +7,18 @@ import {
|
|||||||
import { usePortalsLifecycle } from '../react';
|
import { usePortalsLifecycle } from '../react';
|
||||||
import { PaneviewApi } from '../../api/component.api';
|
import { PaneviewApi } from '../../api/component.api';
|
||||||
import { PanePanelSection } from './view';
|
import { PanePanelSection } from './view';
|
||||||
import { PanelCollection } from '../types';
|
import { PanelCollection, PanelParameters } from '../types';
|
||||||
import { watchElementResize } from '../../dom';
|
import { watchElementResize } from '../../dom';
|
||||||
|
|
||||||
export interface PaneviewReadyEvent {
|
export interface PaneviewReadyEvent {
|
||||||
api: PaneviewApi;
|
api: PaneviewApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPaneviewPanelProps {
|
export interface IPaneviewPanelProps<T extends {} = Record<string, any>>
|
||||||
|
extends PanelParameters<T> {
|
||||||
api: PaneviewPanelApi;
|
api: PaneviewPanelApi;
|
||||||
containerApi: PaneviewApi;
|
containerApi: PaneviewApi;
|
||||||
title: string;
|
title: string;
|
||||||
[key: string]: any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPaneviewReactProps {
|
export interface IPaneviewReactProps {
|
||||||
|
@ -31,7 +31,7 @@ export class PanePanelSection implements IPaneBodyPart {
|
|||||||
this.reactPortalStore,
|
this.reactPortalStore,
|
||||||
this.component,
|
this.component,
|
||||||
{
|
{
|
||||||
...parameters.params,
|
params: parameters.params,
|
||||||
api: parameters.api,
|
api: parameters.api,
|
||||||
title: parameters.title,
|
title: parameters.title,
|
||||||
containerApi: parameters.containerApi,
|
containerApi: parameters.containerApi,
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
} from '../../splitview/splitviewComponent';
|
} from '../../splitview/splitviewComponent';
|
||||||
import { Orientation } from '../../splitview/core/splitview';
|
import { Orientation } from '../../splitview/core/splitview';
|
||||||
import { usePortalsLifecycle } from '../react';
|
import { usePortalsLifecycle } from '../react';
|
||||||
import { PanelCollection } from '../types';
|
import { PanelCollection, PanelParameters } from '../types';
|
||||||
import { ReactPanelView } from './view';
|
import { ReactPanelView } from './view';
|
||||||
import { watchElementResize } from '../../dom';
|
import { watchElementResize } from '../../dom';
|
||||||
|
|
||||||
@ -15,10 +15,10 @@ export interface SplitviewReadyEvent {
|
|||||||
api: SplitviewApi;
|
api: SplitviewApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISplitviewPanelProps {
|
export interface ISplitviewPanelProps<T extends {} = Record<string, any>>
|
||||||
|
extends PanelParameters<T> {
|
||||||
api: SplitviewPanelApi;
|
api: SplitviewPanelApi;
|
||||||
containerApi: SplitviewApi;
|
containerApi: SplitviewApi;
|
||||||
[key: string]: any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISplitviewReactProps {
|
export interface ISplitviewReactProps {
|
||||||
|
@ -19,7 +19,7 @@ export class ReactPanelView extends SplitviewPanel {
|
|||||||
this.reactPortalStore,
|
this.reactPortalStore,
|
||||||
this.reactComponent,
|
this.reactComponent,
|
||||||
{
|
{
|
||||||
...(this.params?.params || {}),
|
params: this.params?.params || {},
|
||||||
api: this.api,
|
api: this.api,
|
||||||
containerApi: (this.params as PanelViewInitParameters)
|
containerApi: (this.params as PanelViewInitParameters)
|
||||||
.containerApi,
|
.containerApi,
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
|
||||||
export interface PanelCollection<T extends object> {
|
export interface PanelCollection<T extends object> {
|
||||||
[name: string]: React.FunctionComponent<T>;
|
[name: string]: React.FunctionComponent<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface PanelParameters<T extends {} = Record<string, any>> {
|
||||||
|
params: T;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user