From d84b6d628b879679955d62e053bf60f97f6e5b95 Mon Sep 17 00:00:00 2001 From: qiusen Date: Wed, 29 May 2024 19:47:24 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix(table):=20=E4=BF=AE=E5=A4=8D=E8=99=9A?= =?UTF-8?q?=E6=8B=9F=E5=88=97=E8=A1=A8maxHeight=E6=97=A0=E6=B3=95=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=AD=97=E7=AC=A6=E4=B8=B2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ui/table/src/TableBody.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui/table/src/TableBody.tsx b/packages/ui/table/src/TableBody.tsx index 362d32297..c9fa2401f 100644 --- a/packages/ui/table/src/TableBody.tsx +++ b/packages/ui/table/src/TableBody.tsx @@ -87,7 +87,7 @@ export const TableBody = forwardRef( style={{ height: 2, marginTop: -1, background: 'transparent', width: rowWidth }} > {isArrayNonEmpty(transitionData) ? ( -
+
Date: Wed, 29 May 2024 19:56:12 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix(table):=20=E5=A2=9E=E5=8A=A0changeset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/rude-baboons-explode.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/rude-baboons-explode.md diff --git a/.changeset/rude-baboons-explode.md b/.changeset/rude-baboons-explode.md new file mode 100644 index 000000000..85db1e0e8 --- /dev/null +++ b/.changeset/rude-baboons-explode.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/table": patch +--- + +fix(table): 修复虚拟列表 maxHeight 无法支持字符串问题 From f74378cfbae0ce37d0d26b2c9a84a806c453ca3a Mon Sep 17 00:00:00 2001 From: qiusen Date: Thu, 30 May 2024 11:01:47 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix(table):=20=E4=BF=AE=E5=A4=8D=E8=99=9A?= =?UTF-8?q?=E6=8B=9F=E5=88=97=E8=A1=A8maxHeight=E6=97=A0=E6=B3=95=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=AD=97=E7=AC=A6=E4=B8=B2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ui/table/src/TableBody.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ui/table/src/TableBody.tsx b/packages/ui/table/src/TableBody.tsx index c9fa2401f..dfa4c22bd 100644 --- a/packages/ui/table/src/TableBody.tsx +++ b/packages/ui/table/src/TableBody.tsx @@ -60,12 +60,12 @@ export const TableBody = forwardRef( // TODO: avg和summay row的逻辑 const realHeight = scrollBodyElementRef.current?.getBoundingClientRect().height + const maxHeightNumStr = String(maxHeight).replace(/px$/, '') const vMaxHeight = maxHeight - ? !isNaN(Number(String(maxHeight).replace(/px/, ''))) - ? Number(maxHeight) + ? !isNaN(Number(maxHeightNumStr)) + ? Number(maxHeightNumStr) : realHeight : 300 - return (
( style={{ height: 2, marginTop: -1, background: 'transparent', width: rowWidth }} >
{isArrayNonEmpty(transitionData) ? ( -
+
Date: Thu, 6 Jun 2024 10:07:28 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix(table):=20=E4=BF=AE=E5=A4=8D=E8=99=9A?= =?UTF-8?q?=E6=8B=9F=E5=88=97=E8=A1=A8maxHeight=E6=97=A0=E6=B3=95=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=AD=97=E7=AC=A6=E4=B8=B2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ui/table/src/TableBody.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/ui/table/src/TableBody.tsx b/packages/ui/table/src/TableBody.tsx index dfa4c22bd..3c9bb1cc7 100644 --- a/packages/ui/table/src/TableBody.tsx +++ b/packages/ui/table/src/TableBody.tsx @@ -1,4 +1,4 @@ -import React, { forwardRef, useCallback, useEffect, useMemo, useState } from 'react' +import React, { forwardRef, useMemo, useRef } from 'react' import VirtualList from 'rc-virtual-list' import { cx, getPrefixCls } from '@hi-ui/classname' import { __DEV__ } from '@hi-ui/env' @@ -15,7 +15,7 @@ const _role = 'table' const _prefix = getPrefixCls(_role) export const TableBody = forwardRef( - ({ prefixCls = _prefix, emptyContent }, ref) => { + ({ prefixCls = _prefix, emptyContent }) => { const { columns, isExpandTreeRows, @@ -33,7 +33,7 @@ export const TableBody = forwardRef( scrollbar, scrollLeft, } = useTableContext() - + const virtualListRef = useRef(null) const cls = cx(`${prefixCls}-body`) const getRequiredProps = useLatestCallback( @@ -58,8 +58,7 @@ export const TableBody = forwardRef( if (virtual) { // TODO: avg和summay row的逻辑 - - const realHeight = scrollBodyElementRef.current?.getBoundingClientRect().height + const realHeight = (virtualListRef.current as (HTMLTableElement | null))?.getBoundingClientRect().height const maxHeightNumStr = String(maxHeight).replace(/px$/, '') const vMaxHeight = maxHeight ? !isNaN(Number(maxHeightNumStr)) @@ -87,7 +86,7 @@ export const TableBody = forwardRef( style={{ height: 2, marginTop: -1, background: 'transparent', width: rowWidth }} >
{isArrayNonEmpty(transitionData) ? ( -
+
Date: Thu, 6 Jun 2024 10:56:23 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix(table):=20=E5=A2=9E=E5=8A=A0changeset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/khaki-panthers-clean.md | 5 +++++ .changeset/tame-sloths-begin.md | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 .changeset/khaki-panthers-clean.md create mode 100644 .changeset/tame-sloths-begin.md diff --git a/.changeset/khaki-panthers-clean.md b/.changeset/khaki-panthers-clean.md new file mode 100644 index 000000000..7194f47c3 --- /dev/null +++ b/.changeset/khaki-panthers-clean.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/hiui": minor +--- + +fix(table): 修复虚拟列表 maxHeight 无法支持字符串问题 diff --git a/.changeset/tame-sloths-begin.md b/.changeset/tame-sloths-begin.md new file mode 100644 index 000000000..cca20396b --- /dev/null +++ b/.changeset/tame-sloths-begin.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/table": minor +--- + +fix(table): 修复虚拟列表 maxHeight 无法支持字符串问题 From 57e5b5efbdc1abef89d53c8c52e96b099540722f Mon Sep 17 00:00:00 2001 From: qiusen Date: Thu, 6 Jun 2024 15:44:18 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix(table):=20=E5=A2=9E=E5=8A=A0changeset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/khaki-panthers-clean.md | 2 +- .changeset/tame-sloths-begin.md | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 .changeset/tame-sloths-begin.md diff --git a/.changeset/khaki-panthers-clean.md b/.changeset/khaki-panthers-clean.md index 7194f47c3..08828ed76 100644 --- a/.changeset/khaki-panthers-clean.md +++ b/.changeset/khaki-panthers-clean.md @@ -1,5 +1,5 @@ --- -"@hi-ui/hiui": minor +"@hi-ui/hiui": patch --- fix(table): 修复虚拟列表 maxHeight 无法支持字符串问题 diff --git a/.changeset/tame-sloths-begin.md b/.changeset/tame-sloths-begin.md deleted file mode 100644 index cca20396b..000000000 --- a/.changeset/tame-sloths-begin.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@hi-ui/table": minor ---- - -fix(table): 修复虚拟列表 maxHeight 无法支持字符串问题