Skip to content

Commit

Permalink
merge branch menglang
Browse files Browse the repository at this point in the history
  • Loading branch information
MenlgangHuo committed Sep 22, 2023
2 parents 74ee36d + 6aae7f0 commit 4d2ef75
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cubetiq/enhance-antd-table",
"version": "2.1.7",
"version": "2.1.9",
"description": "enhance-antd-table antd-table @antd",
"contributors": [
{
Expand Down
29 changes: 29 additions & 0 deletions src/components/TableProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react'

interface TableContextProps {
tableRef: React.MutableRefObject<HTMLElement>
}

const TableContext = React.createContext<TableContextProps>({
tableRef: null
} as any)

const TableProvider: React.FC<React.PropsWithChildren<TableContextProps>> = (
props
) => {
const tableRef = props.tableRef || React.useRef(null)

return (
<TableContext.Provider
value={{
tableRef
}}
>
{props.children}
</TableContext.Provider>
)
}

export const useTable = () => React.useContext(TableContext)

export default TableProvider
5 changes: 4 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { ColumnTitle } from 'antd/es/table/interface'
import { LiftedColumnVisibleControllerProps } from './components/columnVisibleController'
import { TableSkeleton } from './components/tableSkeleton'
import ResizableTitle from './components/resizeTitle'
// import MotionBody from './components/motionBody'
// import MotionRow from './components/motionRow'
import styled from 'styled-components'

export interface ComponentExposeState {
Expand Down Expand Up @@ -55,6 +57,7 @@ interface enhanceTableInterface<IRowData = any> {
renderOwnSearchInputArgs: renderOwnSearchInputArgs
) => React.ReactNode
}

export interface newColumnsInterface<T = any> extends ColumnProps<T> {
dataIndex: string
}
Expand Down Expand Up @@ -346,4 +349,4 @@ EnhanceAntdTable.propTypes = {

export { TableSkeleton }

export default EnhanceAntdTable
export default EnhanceAntdTable

0 comments on commit 4d2ef75

Please sign in to comment.