From eec624313de88943869f592dd06248455bddedbc Mon Sep 17 00:00:00 2001 From: qiusen Date: Wed, 12 Jun 2024 10:34:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix(table):=20=E4=BF=AE=E5=A4=8D=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E8=A1=8C=E4=B8=AD=E9=80=89=E4=B8=AD=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= =?UTF-8?q?(#2863)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/blue-worms-knock.md | 5 +++++ .changeset/tricky-cars-begin.md | 5 +++++ packages/ui/table/src/BaseTable.tsx | 6 ++++-- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .changeset/blue-worms-knock.md create mode 100644 .changeset/tricky-cars-begin.md diff --git a/.changeset/blue-worms-knock.md b/.changeset/blue-worms-knock.md new file mode 100644 index 000000000..b9ad8ca4b --- /dev/null +++ b/.changeset/blue-worms-knock.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/table": patch +--- + +修复统计行中选中模式下显示异常问题(#2863) diff --git a/.changeset/tricky-cars-begin.md b/.changeset/tricky-cars-begin.md new file mode 100644 index 000000000..a43a6327a --- /dev/null +++ b/.changeset/tricky-cars-begin.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/hiui": patch +--- + +修复统计行中选中模式下显示异常问题(#2863) diff --git a/packages/ui/table/src/BaseTable.tsx b/packages/ui/table/src/BaseTable.tsx index f0730b3e1..14b8dfb25 100644 --- a/packages/ui/table/src/BaseTable.tsx +++ b/packages/ui/table/src/BaseTable.tsx @@ -17,6 +17,7 @@ import { useEmbedExpand, UseEmbedExpandProps } from './hooks/use-embed-expand' import { TheadContent } from './TheadContent' import { ColGroupContent } from './ColGroupContent' import { TbodyContent } from './TbodyContent' +import { SELECTION_DATA_KEY } from './Table'; const _role = 'table' const _prefix = getPrefixCls('table') @@ -126,7 +127,8 @@ export const BaseTable = forwardRef( let hasAvgColumn = false columns.forEach((column, index) => { - if (index === 0) { + // select 模式下,第一个是checkbox,需要移到第二个赋值 + if (index === 0 || (index === 1 && columns[0].dataKey === SELECTION_DATA_KEY)) { // @ts-ignore avgRow.raw[column.dataKey] = i18n.get('table.average') } @@ -149,7 +151,7 @@ export const BaseTable = forwardRef( let hasSumColumn = false columns.forEach((column, index) => { - if (index === 0) { + if (index === 0 || (index === 1 && columns[0].dataKey === SELECTION_DATA_KEY)) { // @ts-ignore sumRow.raw[column.dataKey] = i18n.get('table.total') } From 64d5aa3175bb3ee67eeab862ae899bdfa8fdec9d Mon Sep 17 00:00:00 2001 From: qiusen Date: Wed, 12 Jun 2024 11:13:12 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix(table):=20=E4=BF=AE=E5=A4=8D=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E8=A1=8C=E4=B8=AD=E9=80=89=E4=B8=AD=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= =?UTF-8?q?(#2863)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ui/table/src/BaseTable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui/table/src/BaseTable.tsx b/packages/ui/table/src/BaseTable.tsx index 14b8dfb25..e0fd9845c 100644 --- a/packages/ui/table/src/BaseTable.tsx +++ b/packages/ui/table/src/BaseTable.tsx @@ -127,7 +127,7 @@ export const BaseTable = forwardRef( let hasAvgColumn = false columns.forEach((column, index) => { - // select 模式下,第一个是checkbox,需要移到第二个赋值 + // 行选中模式下,index=0是checkbox列,index=1才是第一列 ; fix issue: https://github.com/XiaoMi/hiui/issues/2863 if (index === 0 || (index === 1 && columns[0].dataKey === SELECTION_DATA_KEY)) { // @ts-ignore avgRow.raw[column.dataKey] = i18n.get('table.average') From eea2ccab4ecd72bca4005a77bd764413818de6c4 Mon Sep 17 00:00:00 2001 From: qiusen Date: Wed, 12 Jun 2024 14:46:11 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix(table):=20=E4=BF=AE=E5=A4=8D=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E8=A1=8C=E4=B8=AD=E9=80=89=E4=B8=AD=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= =?UTF-8?q?(#2863)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/tricky-cars-begin.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/tricky-cars-begin.md b/.changeset/tricky-cars-begin.md index a43a6327a..aede828f8 100644 --- a/.changeset/tricky-cars-begin.md +++ b/.changeset/tricky-cars-begin.md @@ -2,4 +2,4 @@ "@hi-ui/hiui": patch --- -修复统计行中选中模式下显示异常问题(#2863) +fix(table): 修复统计行中选中模式下显示异常问题(#2863)