Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(table): 修复统计行中选中模式下显示异常问题(#2863) #2867

Merged
merged 3 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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