Skip to content

Commit

Permalink
Merge pull request #60 from xiaotiandada/master
Browse files Browse the repository at this point in the history
fix: fix typo、add doc
  • Loading branch information
hemengke1997 authored Oct 16, 2023
2 parents 8a2edde + ba18ede commit fcf7a23
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,22 @@ const Example: React.FC = () => {
1. 手动给 fixed 列添加宽度,然后不设置其余某一个非 fixed 列宽度
2. 不设置 fixed 列宽度(默认 200),然后其余某一列也不设置宽度

## 本地开发

```bash
# 开发调试工具库
pnpm i

pnpm run dev

# 预览调试 example
cd example

pnpm i

pnpm run dev
```

## MIT

[LICENSE](https://github.com/hemengke1997/use-antd-resizable-header/blob/master/LICENSE)
6 changes: 3 additions & 3 deletions src/useAntdResizableHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function useAntdResizableHeader<ColumnType extends ColumnOriginType<ColumnType>>

const [resizableColumns, setResizableColumns] = useSafeState<ColumnType[]>(columnsProp || []) // keep all default vlaue (e.g. defaultFilterValue)

const lastestColumns = useLatest(resizableColumns)
const latestColumns = useLatest(resizableColumns)

const { localColumns: columns, resetLocalColumns } = useLocalColumns({
columnsState,
Expand Down Expand Up @@ -132,15 +132,15 @@ function useAntdResizableHeader<ColumnType extends ColumnOriginType<ColumnType>>
onResizeStartProp?.({
...col,
width,
resizableColumns: lastestColumns.current,
resizableColumns: latestColumns.current,
})
}

const onResizeEnd = (col: ColumnType) => (width: number) => {
onResizeEndProp?.({
...col,
width,
resizableColumns: lastestColumns.current,
resizableColumns: latestColumns.current,
})
}

Expand Down

0 comments on commit fcf7a23

Please sign in to comment.