@deephaven/golden-layout
Version:
A multi-screen javascript Layout manager
70 lines • 2.51 kB
TypeScript
import React from 'react';
import type ItemContainer from '../container/ItemContainer';
import type { ReactComponentConfig } from '../config/ItemConfig';
import { Container } from '../container';
import EventEmitter from './EventEmitter';
export type GLPanelProps = {
glContainer: Container;
glEventHub: EventEmitter;
};
/**
* A specialised GoldenLayout component that binds GoldenLayout container
* lifecycle events to react components
*
* @param container
* @param state state is not required for react components
*/
export default class ReactComponentHandler {
private _container;
private _reactComponent;
private _portalComponent;
private _originalComponentWillUpdate;
private _initialState;
private _reactClass;
constructor(container: ItemContainer<ReactComponentConfig>, state?: unknown);
/**
* Gets the unique key to use for the react component
* @returns Unique key for the component
*/
_key(): string;
/**
* Creates the react class and component and hydrates it with
* the initial state - if one is present
*
* By default, react's getInitialState will be used
*
* Creates a portal so the non-react golden-layout code still works,
* but also allows us to mount the React components in the app's tree
* instead of separate sibling root trees
*/
_render(): void;
/**
* Fired by react when the component is created.
* <p>
* Note: This callback is used instead of the return from `ReactDOM.render` because
* of https://github.com/facebook/react/issues/10309.
* </p>
*
* @param component The component instance created by the `ReactDOM.render` call in the `_render` method.
*/
_gotReactComponent(component: React.ReactInstance): void;
/**
* Removes the component from the DOM and thus invokes React's unmount lifecycle
*/
_destroy(): void;
/**
* Hooks into React's state management and applies the componentstate
* to GoldenLayout
*/
_onUpdate(nextProps: Readonly<unknown>, nextState: Record<string, unknown>): void;
/**
* Retrieves the react class from GoldenLayout's registry
* @returns react class
*/
_getReactClass(): React.ComponentClass<{}, any>;
/**
* Copies and extends the properties array and returns the React element
*/
_getReactComponent(): React.CElement<{}, React.Component<{}, any, any>>;
}
//# sourceMappingURL=ReactComponentHandler.d.ts.map