From 696680cd181c0aba2ea1f7fe0509c54cd28c70ba Mon Sep 17 00:00:00 2001
From: lijianan <574980606@qq.com>
Date: Sun, 14 Sep 2025 20:41:21 +0800
Subject: [PATCH 1/2] chore: sync master into 5.x
---
docs/demo/measureRowRender.md | 8 ++++
docs/examples/measureRowRender.tsx | 65 +++++++++++++++++-------------
src/FixedHolder/index.tsx | 37 ++++++-----------
src/interface.ts | 2 +-
4 files changed, 58 insertions(+), 54 deletions(-)
create mode 100644 docs/demo/measureRowRender.md
diff --git a/docs/demo/measureRowRender.md b/docs/demo/measureRowRender.md
new file mode 100644
index 000000000..ad03eef23
--- /dev/null
+++ b/docs/demo/measureRowRender.md
@@ -0,0 +1,8 @@
+---
+title: measureRowRender
+nav:
+ title: measureRowRender
+ path: /demo
+---
+
+
diff --git a/docs/examples/measureRowRender.tsx b/docs/examples/measureRowRender.tsx
index c57557a54..ad482c455 100644
--- a/docs/examples/measureRowRender.tsx
+++ b/docs/examples/measureRowRender.tsx
@@ -1,38 +1,47 @@
import React from 'react';
import Table from 'rc-table';
+import type { TableProps } from 'rc-table';
-// 示例:使用 measureRowRender 来隐藏 MeasureRow 中的弹层
-const MeasureRowRenderExample = () => {
- const columns = [
- {
- title: (
-
- Name
-
- Filter Content
-
+const columns = [
+ {
+ title: (
+
+ Name
+
+ Filter Content
- ),
- dataIndex: 'name',
- key: 'name',
- width: 100,
- },
- {
- title: 'Age',
- dataIndex: 'age',
- key: 'age',
- width: 80,
- },
- ];
+
+ ),
+ dataIndex: 'name',
+ key: 'name',
+ width: 100,
+ },
+ {
+ title: 'Age',
+ dataIndex: 'age',
+ key: 'age',
+ width: 80,
+ },
+];
- const data = [
- { key: 1, name: 'John', age: 25 },
- { key: 2, name: 'Jane', age: 30 },
- ];
+const data = [
+ { key: 1, name: 'John', age: 25 },
+ { key: 2, name: 'Jane', age: 30 },
+ { key: 3, name: 'Jime', age: 35 },
+];
- // 自定义 MeasureRow 渲染,隐藏弹层内容
- const measureRowRender = measureRow =>
{measureRow}
;
+// 自定义 MeasureRow 渲染,隐藏弹层内容
+const measureRowRender: TableProps['measureRowRender'] = measureRow => {
+ if (React.isValidElement(measureRow)) {
+ return React.cloneElement
(measureRow, {
+ style: { ...(measureRow.props as any).style, display: 'none' },
+ });
+ }
+ return measureRow;
+};
+// 示例:使用 measureRowRender 来隐藏 MeasureRow 中的弹层
+const MeasureRowRenderExample: React.FC = () => {
return (
>((pro
const mergedColumnWidth = useColumnWidth(colWidths, columCount);
- const colGroupNode = useMemo(() => {
+ const isColGroupEmpty = useMemo(() => {
// use original ColGroup if no data or no calculated column width, otherwise use calculated column width
// Return original colGroup if no data, or mergedColumnWidth is empty, or all widths are falsy
- if (
- noData ||
- !mergedColumnWidth ||
- mergedColumnWidth.length === 0 ||
- mergedColumnWidth.every(width => !width)
- ) {
- return colGroup;
- }
- return (
-
- );
- }, [
- noData,
- mergedColumnWidth,
- colGroup,
- combinationScrollBarSize,
- columCount,
- flattenColumnsWithScrollbar,
- ]);
+ const noWidth =
+ !mergedColumnWidth || !mergedColumnWidth.length || mergedColumnWidth.every(w => !w);
+ return noData || noWidth;
+ }, [noData, mergedColumnWidth]);
return (
>((pro
width: scrollX,
}}
>
- {colGroupNode}
+ {isColGroupEmpty ? null : (
+
+ )}
{children({
...restProps,
stickyOffsets: headerStickyOffsets,
diff --git a/src/interface.ts b/src/interface.ts
index c6d9a1794..4e4cae55d 100644
--- a/src/interface.ts
+++ b/src/interface.ts
@@ -143,7 +143,7 @@ type Component
=
| React.ComponentType
| React.ForwardRefExoticComponent
| React.FC
- | keyof React.ReactHTML;
+ | keyof React.JSX.IntrinsicElements;
export type CustomizeComponent = Component;
From 6fff9574f628edde853e24d228f35c614f01c0ca Mon Sep 17 00:00:00 2001
From: lijianan <574980606@qq.com>
Date: Mon, 15 Sep 2025 15:23:02 +0800
Subject: [PATCH 2/2] fix: should pass colGroup (#1356)
* test: update test snap
* update
---
src/FixedHolder/index.tsx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/FixedHolder/index.tsx b/src/FixedHolder/index.tsx
index dadc645fd..17881b8b1 100644
--- a/src/FixedHolder/index.tsx
+++ b/src/FixedHolder/index.tsx
@@ -164,7 +164,9 @@ const FixedHolder = React.forwardRef>((pro
width: scrollX,
}}
>
- {isColGroupEmpty ? null : (
+ {isColGroupEmpty ? (
+ colGroup
+ ) : (