import React, { createContext, PropsWithChildren, useContext } from 'react' import { ComponentSize } from '../../ConfigProvider' import { TableSelectionType } from '../types' export type TableContextValue = { prefix: string size: ComponentSize selectionType?: TableSelectionType fixHead: boolean getContainer(): HTMLDivElement | null } const tableContext = createContext(null) export function useTable() { const context = useContext(tableContext) if (context == null) { throw Error('Oops, you should use `useTable` in Table.') } return context } export default function TableProvider({ children, value }: PropsWithChildren<{ value: TableContextValue }>) { return {children} }