import React from 'react' ; import ReactDOM from 'react-dom' ; import { Container , ContainerInput , EmbeddableStart , } from '../../../../src/plugins/embeddable/public' ; import { ListContainerComponent } from './list_container_component' ; export const LIST_CONTAINER = 'LIST_CONTAINER' ; export class ListContainer extends Container < { } , ContainerInput > { public readonly type = LIST_CONTAINER ; private node ? : HTMLElement ; constructor ( input , private embeddableServices ) { super ( input , { embeddableLoaded : { } } , embeddableServices . getEmbeddableFactory ) ; } getInheritedInput ( ) { return { viewMode : this . input . viewMode , } ; } public render ( node ) { if ( this . node ) { ReactDOM . unmountComponentAtNode ( this . node ) ; } this . node = node ; ReactDOM . render ( < ListContainerComponent embeddable = { this } embeddableServices = { this . embeddableServices } / > , node ) ; } public destroy ( ) { super . destroy ( ) ; if ( this . node ) { ReactDOM . unmountComponentAtNode ( this . node ) ; } } }