diff --git a/.changeset/moody-bikes-raise.md b/.changeset/moody-bikes-raise.md index 683ccfd6a..d38a279fb 100644 --- a/.changeset/moody-bikes-raise.md +++ b/.changeset/moody-bikes-raise.md @@ -1,6 +1,6 @@ --- -"@hi-ui/table": patch -"@hi-ui/hiui": patch +"@hi-ui/table": minor +"@hi-ui/hiui": minor --- feat(table): 设置滚动位置(#3044) diff --git a/packages/ui/table/src/types.ts b/packages/ui/table/src/types.ts index 72be7fd0b..0585662e2 100644 --- a/packages/ui/table/src/types.ts +++ b/packages/ui/table/src/types.ts @@ -1,7 +1,6 @@ import React from 'react' import { PaginationProps } from '@hi-ui/pagination' import { PopperOverlayProps } from '@hi-ui/popper' -import { TreeHelper } from '@hi-ui/tree' export type TableColumnItemAlignEnum = 'left' | 'right' | 'center' @@ -306,4 +305,20 @@ export interface TableRowRequiredProps { export type TableRowRecord = Record -export type TableHelper = TreeHelper +export type ScrollAlign = 'top' | 'bottom' | 'auto' + +export type ScrollConfig = + | { + index: number + align?: ScrollAlign + offset?: number + } + | { + key: React.Key + align?: ScrollAlign + offset?: number + } + +export interface TableHelper { + scrollTo?: (arg: number | ScrollConfig) => void +}