import { App, defineComponent } from 'vue';
import TableLayout from './TableLayout';
import { Filter, FilterLeft, FilterRight } from './components/Filter';
import { FilterSecond } from './components/FilterSecond';
import { Table } from './components/Table';
import { Main } from './components/Main';
import { Drawer } from './components/Drawer';

const PREFIX = 'Tl';
Filter.name = `${PREFIX}Filter`;
FilterLeft.name = `${PREFIX}FilterLeft`;
FilterRight.name = `${PREFIX}FilterRight`;
FilterSecond.name = `${PREFIX}FilterSecond`;
Table.name = `${PREFIX}Table`;
Main.name = `${PREFIX}Main`;
Drawer.name = `${PREFIX}Drawer`;

export {
  Filter as TlFilter,
  FilterLeft as TlFilterLeft,
  FilterRight as TlFilterRight,
  FilterSecond as TlFilterSecond,
  Table as TlTable,
  Main as TlMain,
  Drawer as TlDrawer
};

TableLayout.install = (app: App, options: any = {}) => {
  app.component(TableLayout.name, TableLayout);

  // 全局注册 TableLayout 附加组件
  app.component(Filter.name, Filter);
  app.component(FilterLeft.name, FilterLeft);
  app.component(FilterRight.name, FilterRight);
  app.component(FilterSecond.name, FilterSecond);
  app.component(Table.name, Table);
  app.component(Main.name, Main);
  app.component(Drawer.name, Drawer);
};
export default TableLayout;

export * from './utils/key';
