@chamn/engine
Version:
40 lines (39 loc) • 1.38 kB
TypeScript
import { CNode, CRootNode } from '@chamn/model';
import { default as React } from 'react';
import { CPluginCtx } from '../../core/pluginManager';
export type RightPanelOptions = {
node: CNode | CRootNode | null;
pluginCtx: CPluginCtx;
activeTab: string;
};
export type CRightPanelItem = {
key: string;
name: string | ((props: RightPanelOptions) => React.ReactNode);
view: (props: RightPanelOptions) => React.ReactNode;
show?: (options: RightPanelOptions) => boolean;
};
interface RightPanelProps {
pluginCtx: CPluginCtx;
}
interface RightPanelState {
node: CNode | CRootNode | null;
activeKey: string;
panels: CRightPanelItem[];
displayPanels: CRightPanelItem[];
}
export declare class RightPanel extends React.Component<RightPanelProps, RightPanelState> {
constructor(props: RightPanelProps);
addPanel: (panel: CRightPanelItem) => void;
removePanel: (panelName: string) => void;
replacePanel: (panelName: string, newPanel: CRightPanelItem) => void;
choosePanel: (panelName: string) => void;
/** 更新被展示的 panel, 根据 panel 的 show 方法 */
updatePanels: () => {
panels: CRightPanelItem[];
displayPanels: CRightPanelItem[];
};
onNodeChange: ({ node }: any) => void;
componentDidMount(): void;
render(): import("react/jsx-runtime").JSX.Element;
}
export {};