import React from 'react' ; import { render , unmountComponentAtNode } from 'react-dom' ; import type { EventEmitter } from 'events' ; import type { Vis , VisualizeEmbeddableContract , IEditorController , EditorRenderProps , } from 'src/plugins/visualizations/public' ; import { getUISettings , getI18n , getCoreStart } from '../services' ; import { VisEditor } from './components/vis_editor_lazy' ; import type { TimeseriesVisParams } from '../types' ; import { KibanaThemeProvider } from '../../../../../../src/plugins/kibana_react/public' ; export const TSVB_EDITOR_NAME = 'tsvbEditor' ; export class EditorController implements IEditorController { constructor ( private el , private vis , private eventEmitter , private embeddableHandler ) { } render ( { timeRange , uiState , filters , query } ) { const I18nContext = getI18n ( ) . Context ; render ( < I18nContext > < KibanaThemeProvider theme$ = { getCoreStart ( ) . theme . theme$ } > < VisEditor config = { getUISettings ( ) } vis = { this . vis } timeRange = { timeRange } embeddableHandler = { this . embeddableHandler } eventEmitter = { this . eventEmitter } uiState = { uiState } filters = { filters } query = { query } / > < /KibanaThemeProvider> < /I18nContext>, this.el); } destroy ( ) { unmountComponentAtNode ( this . el ) ; } }