From fd4ce737683da8a6e916ab29d973a68a445a8a80 Mon Sep 17 00:00:00 2001 From: biubiukam Date: Wed, 15 Jul 2026 04:48:52 +0800 Subject: [PATCH 1/3] fix: hide row series number in aggregation rows --- ...able-row-series-number-aggregation.test.ts | 39 +++++++++++++++++++ packages/vtable/src/ListTable.ts | 6 +++ 2 files changed, 45 insertions(+) create mode 100644 packages/vtable/__tests__/options/listTable-row-series-number-aggregation.test.ts diff --git a/packages/vtable/__tests__/options/listTable-row-series-number-aggregation.test.ts b/packages/vtable/__tests__/options/listTable-row-series-number-aggregation.test.ts new file mode 100644 index 000000000..188afc922 --- /dev/null +++ b/packages/vtable/__tests__/options/listTable-row-series-number-aggregation.test.ts @@ -0,0 +1,39 @@ +// @ts-nocheck +import { ListTable, TYPES } from '../../src'; +import { createDiv } from '../dom'; + +global.__VERSION__ = 'none'; + +describe('ListTable row series number with aggregation', () => { + const container = createDiv(); + container.style.width = '600px'; + container.style.height = '400px'; + + const table = new ListTable(container, { + records: [{ value: 1 }, { value: 2 }], + columns: [ + { + field: 'value', + title: 'Value', + aggregation: { + aggregationType: TYPES.AggregationType.SUM + } + } + ], + rowSeriesNumber: { + title: 'No.' + } + }); + + afterAll(() => { + table.release(); + }); + + test('does not display a series number in the aggregation row', () => { + const aggregationRow = table.rowCount - 1; + + expect(table.internalProps.layoutMap.isAggregation(0, aggregationRow)).toBe(true); + expect(table.getCellValue(0, aggregationRow)).toBe(''); + expect(table.getCellOriginValue(0, aggregationRow)).toBe(''); + }); +}); diff --git a/packages/vtable/src/ListTable.ts b/packages/vtable/src/ListTable.ts index 070c74ee6..e029b739c 100644 --- a/packages/vtable/src/ListTable.ts +++ b/packages/vtable/src/ListTable.ts @@ -579,6 +579,9 @@ export class ListTable extends BaseTable implements ListTableAPI { const { title } = table.internalProps.layoutMap.getSeriesNumberHeader(col, row); return title; } + if (table.internalProps.layoutMap.isAggregation(col, row)) { + return ''; + } let value; if ((this.internalProps as ListTableProtected).groupBy) { const record = table.getCellRawRecord(col, row); @@ -629,6 +632,9 @@ export class ListTable extends BaseTable implements ListTableAPI { const { title } = table.internalProps.layoutMap.getSeriesNumberHeader(col, row); return title; } + if (table.internalProps.layoutMap.isAggregation(col, row)) { + return ''; + } const { format } = table.internalProps.layoutMap.getSeriesNumberBody(col, row); return typeof format === 'function' ? format(col, row, this) : row - this.columnHeaderLevelCount; } else if (table.internalProps.layoutMap.isHeader(col, row)) { From 993a8d1ff7dc69f5b37d218619a5da07f9952349 Mon Sep 17 00:00:00 2001 From: biubiukam Date: Wed, 15 Jul 2026 04:50:35 +0800 Subject: [PATCH 2/3] docs: update changlog of rush --- ...13-aggregation-series-number_2026-07-14-20-50.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vtable/fix-issue-5213-aggregation-series-number_2026-07-14-20-50.json diff --git a/common/changes/@visactor/vtable/fix-issue-5213-aggregation-series-number_2026-07-14-20-50.json b/common/changes/@visactor/vtable/fix-issue-5213-aggregation-series-number_2026-07-14-20-50.json new file mode 100644 index 000000000..13a5b655a --- /dev/null +++ b/common/changes/@visactor/vtable/fix-issue-5213-aggregation-series-number_2026-07-14-20-50.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: hide row series number in aggregation rows", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "biukam.w@gmail.com" +} \ No newline at end of file From 808ac423ff85612da98a1cc8a99a8ba3d10f50bb Mon Sep 17 00:00:00 2001 From: fangsmile <892739385@qq.com> Date: Mon, 20 Jul 2026 11:58:40 +0800 Subject: [PATCH 3/3] demo: add issue 5213 reproduction --- ...ssue-5213-row-series-number-aggregation.ts | 84 +++++++++++++++++++ packages/vtable/examples/menu.ts | 4 + 2 files changed, 88 insertions(+) create mode 100644 packages/vtable/examples/debug/issue-5213-row-series-number-aggregation.ts diff --git a/packages/vtable/examples/debug/issue-5213-row-series-number-aggregation.ts b/packages/vtable/examples/debug/issue-5213-row-series-number-aggregation.ts new file mode 100644 index 000000000..42efd2690 --- /dev/null +++ b/packages/vtable/examples/debug/issue-5213-row-series-number-aggregation.ts @@ -0,0 +1,84 @@ +import * as VTable from '../../src'; + +const CONTAINER_ID = 'vTable'; + +const removeDemoToolbar = () => { + document.getElementById('issue5213Toolbar')?.remove(); +}; + +const setStatus = (message: string, pass: boolean) => { + const statusNode = document.getElementById('issue5213Status'); + if (!statusNode) { + return; + } + statusNode.textContent = message; + statusNode.style.color = pass ? '#237804' : '#cf1322'; +}; + +export function createTable() { + removeDemoToolbar(); + + const container = document.getElementById(CONTAINER_ID)!; + container.style.width = '640px'; + container.style.height = '360px'; + + const toolbar = document.createElement('div'); + toolbar.id = 'issue5213Toolbar'; + toolbar.style.cssText = [ + 'display: flex', + 'gap: 8px', + 'align-items: center', + 'height: 40px', + 'font-size: 12px' + ].join(';'); + toolbar.innerHTML = ` + + 预期:聚合行序号列为空;旧逻辑会显示行号。 + + `; + container.before(toolbar); + + const tableInstance = new VTable.ListTable(container, { + records: [{ value: 1 }, { value: 2 }], + columns: [ + { + field: 'value', + title: 'Value', + width: 160, + aggregation: { + aggregationType: VTable.TYPES.AggregationType.SUM + } + } + ], + rowSeriesNumber: { + title: 'No.' + }, + defaultRowHeight: 36 + }); + + const checkAggregationSeriesNumber = () => { + const aggregationRow = tableInstance.rowCount - 1; + const displayValue = tableInstance.getCellValue(0, aggregationRow); + const originValue = tableInstance.getCellOriginValue(0, aggregationRow); + const isAggregation = tableInstance.internalProps.layoutMap.isAggregation(0, aggregationRow); + const pass = isAggregation && displayValue === '' && originValue === ''; + + setStatus( + `${pass ? 'PASS' : 'FAIL'} | aggregationRow=${aggregationRow}, display=${String(displayValue)}, origin=${String( + originValue + )}`, + pass + ); + }; + + document.getElementById('issue5213Check')?.addEventListener('click', checkAggregationSeriesNumber); + requestAnimationFrame(checkAggregationSeriesNumber); + + const release = tableInstance.release.bind(tableInstance); + tableInstance.release = () => { + removeDemoToolbar(); + release(); + }; + + (window as any).tableInstance = tableInstance; +} diff --git a/packages/vtable/examples/menu.ts b/packages/vtable/examples/menu.ts index 5f040cb70..2474d4e3a 100644 --- a/packages/vtable/examples/menu.ts +++ b/packages/vtable/examples/menu.ts @@ -50,6 +50,10 @@ export const menus = [ path: 'debug', name: 'issue-5187-max-frozen-width' }, + { + path: 'debug', + name: 'issue-5213-row-series-number-aggregation' + }, { path: 'debug', name: 'header-frame-border-null-color'