Skip to content

Commit

Permalink
feat(table): SettingDrawer 增加 onReset api (#3021)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyprepare committed Oct 16, 2024
1 parent 93ff5b4 commit f28879b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/green-points-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@hi-ui/table": minor
"@hi-ui/hiui": minor
---

feat(table): SettingDrawer 增加 onReset api (#3021)
7 changes: 7 additions & 0 deletions packages/ui/table/src/SettingDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const SettingDrawer = forwardRef<HTMLDivElement | null, SettingDrawerProp
sortedColKeys: sortedColKeysPropBeforeVerify,
onSortedColKeysChange,
onSetColKeysChange,
onReset,
checkDisabledColKeys,
dragDisabledColKeys,
extraHeader,
Expand Down Expand Up @@ -89,6 +90,8 @@ export const SettingDrawer = forwardRef<HTMLDivElement | null, SettingDrawerProp
const resetLatest = useLatestCallback(() => {
setCacheHiddenColKeys(hiddenColKeys)
setCacheSortedCols(sortedCols)

onReset?.()
})

// 当 visible 由 false 变为 true 时触发
Expand Down Expand Up @@ -220,6 +223,10 @@ export interface SettingDrawerProps extends HiBaseHTMLProps<'div'> {
hiddenColKeys: string[],
visibleCols: TableColumnItem[]
) => void
/**
* 重置按钮点击时回调
*/
onReset?: () => void
/**
* 隐藏列
*/
Expand Down

0 comments on commit f28879b

Please sign in to comment.