Skip to content

Commit

Permalink
Merge pull request #2867 from aqiusen/hotfix/table/2863
Browse files Browse the repository at this point in the history
fix(table): 修复统计行中选中模式下显示异常问题(#2863)
  • Loading branch information
solarjoker authored Jun 14, 2024
2 parents 9416cd0 + eea2cca commit 841f9ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/blue-worms-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/table": patch
---

修复统计行中选中模式下显示异常问题(#2863)
5 changes: 5 additions & 0 deletions .changeset/tricky-cars-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/hiui": patch
---

fix(table): 修复统计行中选中模式下显示异常问题(#2863)
6 changes: 4 additions & 2 deletions packages/ui/table/src/BaseTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -126,7 +127,8 @@ export const BaseTable = forwardRef<HTMLDivElement | null, BaseTableProps>(
let hasAvgColumn = false

columns.forEach((column, index) => {
if (index === 0) {
// 行选中模式下,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')
}
Expand All @@ -149,7 +151,7 @@ export const BaseTable = forwardRef<HTMLDivElement | null, BaseTableProps>(
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')
}
Expand Down

0 comments on commit 841f9ff

Please sign in to comment.