From 44f90cfe617c0eda2806778a7206ec7400f7737d Mon Sep 17 00:00:00 2001 From: wanjinping Date: Mon, 18 Nov 2024 20:09:07 +0800 Subject: [PATCH] =?UTF-8?q?chore(table):=20=E8=A7=84=E8=8C=83=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=BB=93=E6=9E=84(#3044)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/moody-bikes-raise.md | 4 ++-- packages/ui/table/src/types.ts | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) 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 +}