import React from 'react';
import { ReactWidget } from '@jupyterlab/apputils';
import { Widget } from '@lumino/widgets';
import { ISignal, Signal } from '@lumino/signaling';
import DataManage from './datamanage';

interface ITableData {
  table: any;
}
class DataManagerWidget extends ReactWidget {
  constructor(options: Widget.IOptions = {}) {
    super(options);
  }

  public get dataOpened(): ISignal<DataManagerWidget, ITableData> {
    return this._dataOpened;
  }

  render(): JSX.Element {
    return (
      <DataManage onOpenData={table => this._dataOpened.emit({ table })} />
    );
  }
  private _dataOpened = new Signal<DataManagerWidget, ITableData>(this);
}

export default DataManagerWidget;
