mirror of
https://github.com/mathuo/dockview
synced 2025-02-08 17:35:44 +00:00
code
This commit is contained in:
parent
8f0822c57e
commit
9e26f3d47c
@ -1,18 +1,22 @@
|
||||
import { Emitter, Event } from '../events';
|
||||
import { CompositeDisposable, IDisposable } from '../lifecycle';
|
||||
|
||||
// anything that is serializable JSON should be valid here
|
||||
type StateObject =
|
||||
/**
|
||||
* A valid JSON type
|
||||
*/
|
||||
export type StateObject =
|
||||
| number
|
||||
| string
|
||||
| boolean
|
||||
| undefined
|
||||
| null
|
||||
| object
|
||||
| StateObject[]
|
||||
| { [key: string]: StateObject };
|
||||
|
||||
interface State {
|
||||
/**
|
||||
* A JSON-serializable object
|
||||
*/
|
||||
export interface State {
|
||||
[key: string]: StateObject;
|
||||
}
|
||||
|
||||
|
@ -25,14 +25,12 @@ export interface GroupPanelPartInitParameters
|
||||
}
|
||||
|
||||
export interface PanelHeaderPart extends IPanel {
|
||||
id: string;
|
||||
element: HTMLElement;
|
||||
init?(parameters: GroupPanelPartInitParameters);
|
||||
setVisible(isPanelVisible: boolean, isGroupVisible: boolean): void;
|
||||
}
|
||||
|
||||
export interface PanelContentPart extends IPanel {
|
||||
id: string;
|
||||
element: HTMLElement;
|
||||
setVisible(isPanelVisible: boolean, isGroupVisible: boolean): void;
|
||||
init?(parameters: GroupPanelPartInitParameters);
|
||||
@ -49,7 +47,6 @@ export interface IGroupPanelInitParameters
|
||||
}
|
||||
|
||||
export interface IGroupPanel extends IDisposable, IPanel {
|
||||
id: string;
|
||||
header: PanelHeaderPart;
|
||||
content: PanelContentPart;
|
||||
group: IGroupview;
|
||||
|
@ -1,15 +1,24 @@
|
||||
import { State } from '../api/api';
|
||||
import { IDisposable } from '../lifecycle';
|
||||
|
||||
/**
|
||||
* A key-value object of anything that is a valid JavaScript Object.
|
||||
*/
|
||||
export interface Parameters {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface PanelInitParameters {
|
||||
params: { [index: string]: any };
|
||||
state?: { [index: string]: any };
|
||||
params: Parameters;
|
||||
state?: State;
|
||||
}
|
||||
|
||||
export interface PanelUpdateEvent {
|
||||
params: { [index: string]: any };
|
||||
params: Parameters;
|
||||
}
|
||||
|
||||
export interface IPanel extends IDisposable {
|
||||
readonly id: string;
|
||||
init?(params: PanelInitParameters): void;
|
||||
layout?(width: number, height: number): void;
|
||||
update?(event: PanelUpdateEvent): void;
|
||||
|
@ -11,7 +11,7 @@ export class BaseReactComponentGridView<T extends BaseViewApi>
|
||||
implements IPanel {
|
||||
private _element: HTMLElement;
|
||||
private part: ReactPart;
|
||||
private params: { params: any };
|
||||
private params: PanelInitParameters;
|
||||
|
||||
private _onDidChange: Emitter<number | undefined> = new Emitter<
|
||||
number | undefined
|
||||
@ -66,7 +66,7 @@ export class BaseReactComponentGridView<T extends BaseViewApi>
|
||||
}
|
||||
|
||||
update(params: PanelUpdateEvent) {
|
||||
this.params = { ...this.params.params, ...params };
|
||||
this.params = { ...this.params, params: params.params };
|
||||
this.part.update(params);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ReactLayout } from '../dockview/dockview';
|
||||
import { PanelInitParameters, IPanel } from '../../panel/types';
|
||||
import { PanelInitParameters } from '../../panel/types';
|
||||
import { IGridPanelComponentView } from '../../gridview/componentGridview';
|
||||
import { FunctionOrValue } from '../../types';
|
||||
import { BaseReactComponentGridView } from '../baseReactComponentView';
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IView } from '../../splitview/splitview';
|
||||
import { ReactLayout } from '../dockview/dockview';
|
||||
import { ISplitviewPanelProps } from './splitview';
|
||||
import { IPanel } from '../../panel/types';
|
||||
import { BaseReactComponentGridView } from '../baseReactComponentView';
|
||||
import { PanelApi } from '../../api/panelApi';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user