diff --git a/packages/s2-core/__tests__/bugs/__snapshots__/issue-2684-spec.ts.snap b/packages/s2-core/__tests__/bugs/__snapshots__/issue-2684-spec.ts.snap new file mode 100644 index 0000000000..e9e6da7b4b --- /dev/null +++ b/packages/s2-core/__tests__/bugs/__snapshots__/issue-2684-spec.ts.snap @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`PivotSheet Special Dimension Values Copy Tests should correctly copy data with header 1`] = ` +" 两片罐事业部 宝翼制罐 河北制罐 成都制罐 哈尔滨制罐 + dq dq dq dq dq +2018年-三月 53332 +2019年-三月 53332 +2023年-三月 53332 67456 53332 66293.333333 97192.090909 +2023年-四月 67454 0 70442.733333 56665 100535.760606 +2023年-五月 23566 -10000 73786.40303 65554 103879.430303 +2023年-六月 67456 22222 77130.072727 53332 107223.1 +2023年-七月 0 39998 80473.742424 70442.733333 61292.833333 +2023年-八月 0 48877 83817.412121 73786.40303 66293.333333 +2023年-九月 22222 49999 87161.081818 77130.072727 56665" +`; diff --git a/packages/s2-core/__tests__/bugs/issue-2684-spec.ts b/packages/s2-core/__tests__/bugs/issue-2684-spec.ts new file mode 100644 index 0000000000..ea0365675f --- /dev/null +++ b/packages/s2-core/__tests__/bugs/issue-2684-spec.ts @@ -0,0 +1,60 @@ +/** + * 透视表维值含有 "-", 复制数据时表头缺失 + * @description spec for issue #2684 + * https://github.com/antvis/S2/issues/2684 + */ + +import { isEmpty } from 'lodash'; +import { InteractionStateName } from '../../src'; +import { getSelectedData } from '../../src/utils/export/copy'; +import * as mockDataConfig from '../data/data-issue-2684.json'; +import { createPivotSheet } from '../util/helpers'; +import type { S2Options, SpreadSheet } from '@/index'; + +const s2Options: S2Options = { + width: 600, + height: 480, + interaction: { + enableCopy: true, + copyWithHeader: true, + copyWithFormat: true, + brushSelection: { + data: true, + row: true, + col: true, + }, + multiSelection: true, + }, +}; + +describe('PivotSheet Special Dimension Values Copy Tests', () => { + let s2: SpreadSheet; + + beforeEach(() => { + s2 = createPivotSheet(s2Options); + s2.setDataCfg(mockDataConfig); + s2.render(); + }); + + test('should correctly copy data with header', () => { + const { rowLeafNodes, colLeafNodes } = s2.facet.layoutResult; + const cells = s2.interaction.getPanelGroupAllDataCells().map((cell) => { + const meta = cell.getMeta(); + const colId = String(colLeafNodes[meta.colIndex].id); + const rowId = isEmpty(rowLeafNodes) + ? String(meta.rowIndex) + : String(rowLeafNodes[meta.rowIndex].id); + + return { ...meta, colId, rowId }; + }); + + s2.interaction.changeState({ + cells, + stateName: InteractionStateName.SELECTED, + }); + + const data = getSelectedData(s2); + + expect(data).toMatchSnapshot(); + }); +}); diff --git a/packages/s2-core/__tests__/data/data-issue-2684.json b/packages/s2-core/__tests__/data/data-issue-2684.json new file mode 100644 index 0000000000..d568f09996 --- /dev/null +++ b/packages/s2-core/__tests__/data/data-issue-2684.json @@ -0,0 +1,558 @@ +{ + "fields": { + "rows": ["year-period"], + "columns": ["entity"], + "values": ["dq"], + "valueInCols": true + }, + "meta": [ + { + "field": "year" + }, + { + "field": "dq" + }, + { + "field": "bq" + }, + { + "field": "tq" + }, + { + "field": "mlv" + }, + { + "field": "tb" + }, + { + "field": "period", + "name": "月份" + }, + { + "field": "entity" + }, + { + "field": "year-period" + } + ], + "data": [ + { + "period": "三月", + "year": "2018年", + "entity": "两片罐事业部", + "year-period": "2018年-三月", + "bq": 32223, + "dq": 53332, + "_origin": { + "period": "3", + "year": "2018", + "entity": "Can_BU", + "year-period": "2018-3" + } + }, + { + "period": "三月", + "year": "2019年", + "entity": "两片罐事业部", + "year-period": "2019年-三月", + "bq": 32223, + "dq": 53332, + "_origin": { + "period": "3", + "year": "2019", + "entity": "Can_BU", + "year-period": "2019-3" + } + }, + { + "period": "三月", + "year": "2023年", + "entity": "两片罐事业部", + "year-period": "2023年-三月", + "bq": 61745.2, + "dq": 53332, + "_origin": { + "period": "3", + "year": "2023", + "entity": "Can_BU", + "year-period": "2023-3" + } + }, + { + "period": "三月", + "year": "2023年", + "entity": "宝翼制罐", + "year-period": "2023年-三月", + "bq": 36544, + "dq": 67456, + "_origin": { + "period": "3", + "year": "2023", + "entity": "en10301", + "year-period": "2023-3" + } + }, + { + "period": "三月", + "year": "2023年", + "entity": "河北制罐", + "year-period": "2023年-三月", + "bq": 49096, + "dq": 53332, + "_origin": { + "period": "3", + "year": "2023", + "entity": "En10302", + "year-period": "2023-3" + } + }, + { + "period": "三月", + "year": "2023年", + "entity": "成都制罐", + "year-period": "2023年-三月", + "bq": 74394.4, + "dq": 66293.333333, + "_origin": { + "period": "3", + "year": "2023", + "entity": "En10303", + "year-period": "2023-3" + } + }, + { + "period": "三月", + "year": "2023年", + "entity": "哈尔滨制罐", + "year-period": "2023年-三月", + "bq": 71232.1, + "dq": 97192.090909, + "_origin": { + "period": "3", + "year": "2023", + "entity": "En10314", + "year-period": "2023-3" + } + }, + { + "period": "四月", + "year": "2023年", + "entity": "两片罐事业部", + "year-period": "2023年-四月", + "bq": 62799.3, + "dq": 67454, + "_origin": { + "period": "4", + "year": "2023", + "entity": "Can_BU", + "year-period": "2023-4" + } + }, + { + "period": "四月", + "year": "2023年", + "entity": "宝翼制罐", + "year-period": "2023年-四月", + "bq": 37567, + "dq": 0, + "_origin": { + "period": "4", + "year": "2023", + "entity": "en10301", + "year-period": "2023-4" + } + }, + { + "period": "四月", + "year": "2023年", + "entity": "河北制罐", + "year-period": "2023年-四月", + "bq": 50150.1, + "dq": 70442.733333, + "_origin": { + "period": "4", + "year": "2023", + "entity": "En10302", + "year-period": "2023-4" + } + }, + { + "period": "四月", + "year": "2023年", + "entity": "成都制罐", + "year-period": "2023年-四月", + "bq": 75448.5, + "dq": 56665, + "_origin": { + "period": "4", + "year": "2023", + "entity": "En10303", + "year-period": "2023-4" + } + }, + { + "period": "四月", + "year": "2023年", + "entity": "哈尔滨制罐", + "year-period": "2023年-四月", + "bq": 72286.2, + "dq": 100535.760606, + "_origin": { + "period": "4", + "year": "2023", + "entity": "En10314", + "year-period": "2023-4" + } + }, + { + "period": "五月", + "year": "2023年", + "entity": "两片罐事业部", + "year-period": "2023年-五月", + "bq": 63853.4, + "dq": 23566, + "_origin": { + "period": "5", + "year": "2023", + "entity": "Can_BU", + "year-period": "2023-5" + } + }, + { + "period": "五月", + "year": "2023年", + "entity": "宝翼制罐", + "year-period": "2023年-五月", + "bq": 38555, + "dq": -10000, + "_origin": { + "period": "5", + "year": "2023", + "entity": "en10301", + "year-period": "2023-5" + } + }, + { + "period": "五月", + "year": "2023年", + "entity": "河北制罐", + "year-period": "2023年-五月", + "bq": 51204.2, + "dq": 73786.40303, + "_origin": { + "period": "5", + "year": "2023", + "entity": "En10302", + "year-period": "2023-5" + } + }, + { + "period": "五月", + "year": "2023年", + "entity": "成都制罐", + "year-period": "2023年-五月", + "bq": 76502.6, + "dq": 65554, + "_origin": { + "period": "5", + "year": "2023", + "entity": "En10303", + "year-period": "2023-5" + } + }, + { + "period": "五月", + "year": "2023年", + "entity": "哈尔滨制罐", + "year-period": "2023年-五月", + "bq": 73340.3, + "dq": 103879.430303, + "_origin": { + "period": "5", + "year": "2023", + "entity": "En10314", + "year-period": "2023-5" + } + }, + { + "period": "六月", + "year": "2023年", + "entity": "两片罐事业部", + "year-period": "2023年-六月", + "bq": 64907.5, + "dq": 67456, + "_origin": { + "period": "6", + "year": "2023", + "entity": "Can_BU", + "year-period": "2023-6" + } + }, + { + "period": "六月", + "year": "2023年", + "entity": "宝翼制罐", + "year-period": "2023年-六月", + "bq": 39609.1, + "dq": 22222, + "_origin": { + "period": "6", + "year": "2023", + "entity": "en10301", + "year-period": "2023-6" + } + }, + { + "period": "六月", + "year": "2023年", + "entity": "河北制罐", + "year-period": "2023年-六月", + "bq": 52258.3, + "dq": 77130.072727, + "_origin": { + "period": "6", + "year": "2023", + "entity": "En10302", + "year-period": "2023-6" + } + }, + { + "period": "六月", + "year": "2023年", + "entity": "成都制罐", + "year-period": "2023年-六月", + "bq": 77556.7, + "dq": 53332, + "_origin": { + "period": "6", + "year": "2023", + "entity": "En10303", + "year-period": "2023-6" + } + }, + { + "period": "六月", + "year": "2023年", + "entity": "哈尔滨制罐", + "year-period": "2023年-六月", + "bq": -34394.4, + "dq": 107223.1, + "_origin": { + "period": "6", + "year": "2023", + "entity": "En10314", + "year-period": "2023-6" + } + }, + { + "period": "七月", + "year": "2023年", + "entity": "两片罐事业部", + "year-period": "2023年-七月", + "bq": 65961.6, + "dq": 0, + "_origin": { + "period": "7", + "year": "2023", + "entity": "Can_BU", + "year-period": "2023-7" + } + }, + { + "period": "七月", + "year": "2023年", + "entity": "宝翼制罐", + "year-period": "2023年-七月", + "bq": 40663.2, + "dq": 39998, + "_origin": { + "period": "7", + "year": "2023", + "entity": "en10301", + "year-period": "2023-7" + } + }, + { + "period": "七月", + "year": "2023年", + "entity": "河北制罐", + "year-period": "2023年-七月", + "bq": 53312.4, + "dq": 80473.742424, + "_origin": { + "period": "7", + "year": "2023", + "entity": "En10302", + "year-period": "2023-7" + } + }, + { + "period": "七月", + "year": "2023年", + "entity": "成都制罐", + "year-period": "2023年-七月", + "bq": 78610.8, + "dq": 70442.733333, + "_origin": { + "period": "7", + "year": "2023", + "entity": "En10303", + "year-period": "2023-7" + } + }, + { + "period": "七月", + "year": "2023年", + "entity": "哈尔滨制罐", + "year-period": "2023年-七月", + "bq": 75448.5, + "dq": 61292.833333, + "_origin": { + "period": "7", + "year": "2023", + "entity": "En10314", + "year-period": "2023-7" + } + }, + { + "period": "八月", + "year": "2023年", + "entity": "两片罐事业部", + "year-period": "2023年-八月", + "bq": 67015.7, + "dq": 0, + "_origin": { + "period": "8", + "year": "2023", + "entity": "Can_BU", + "year-period": "2023-8" + } + }, + { + "period": "八月", + "year": "2023年", + "entity": "宝翼制罐", + "year-period": "2023年-八月", + "bq": 41717.3, + "dq": 48877, + "_origin": { + "period": "8", + "year": "2023", + "entity": "en10301", + "year-period": "2023-8" + } + }, + { + "period": "八月", + "year": "2023年", + "entity": "河北制罐", + "year-period": "2023年-八月", + "bq": 54366.5, + "dq": 83817.412121, + "_origin": { + "period": "8", + "year": "2023", + "entity": "En10302", + "year-period": "2023-8" + } + }, + { + "period": "八月", + "year": "2023年", + "entity": "成都制罐", + "year-period": "2023年-八月", + "bq": 79664.9, + "dq": 73786.40303, + "_origin": { + "period": "8", + "year": "2023", + "entity": "En10303", + "year-period": "2023-8" + } + }, + { + "period": "八月", + "year": "2023年", + "entity": "哈尔滨制罐", + "year-period": "2023年-八月", + "bq": 76502.6, + "dq": 66293.333333, + "_origin": { + "period": "8", + "year": "2023", + "entity": "En10314", + "year-period": "2023-8" + } + }, + { + "period": "九月", + "year": "2023年", + "entity": "两片罐事业部", + "year-period": "2023年-九月", + "bq": 68069.8, + "dq": 22222, + "_origin": { + "period": "9", + "year": "2023", + "entity": "Can_BU", + "year-period": "2023-9" + } + }, + { + "period": "九月", + "year": "2023年", + "entity": "宝翼制罐", + "year-period": "2023年-九月", + "bq": 42771.4, + "dq": 49999, + "_origin": { + "period": "9", + "year": "2023", + "entity": "en10301", + "year-period": "2023-9" + } + }, + { + "period": "九月", + "year": "2023年", + "entity": "河北制罐", + "year-period": "2023年-九月", + "bq": 55420.6, + "dq": 87161.081818, + "_origin": { + "period": "9", + "year": "2023", + "entity": "En10302", + "year-period": "2023-9" + } + }, + { + "period": "九月", + "year": "2023年", + "entity": "成都制罐", + "year-period": "2023年-九月", + "bq": 80719, + "dq": 77130.072727, + "_origin": { + "period": "9", + "year": "2023", + "entity": "En10303", + "year-period": "2023-9" + } + }, + { + "period": "九月", + "year": "2023年", + "entity": "哈尔滨制罐", + "year-period": "2023年-九月", + "bq": 77556.7, + "dq": 56665, + "_origin": { + "period": "9", + "year": "2023", + "entity": "En10314", + "year-period": "2023-9" + } + } + ] +} diff --git a/packages/s2-core/__tests__/spreadsheet/total-group-spec.ts b/packages/s2-core/__tests__/spreadsheet/total-group-spec.ts index 8ba7b9b2ca..2c6ec0d399 100644 --- a/packages/s2-core/__tests__/spreadsheet/total-group-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/total-group-spec.ts @@ -366,11 +366,15 @@ describe('Total Group Dimension Test', () => { 'should render correctly group totals layout if data is empty by %o', (config) => { s2 = new PivotSheet(container, dataCfg, { - ...config, - showGrandTotals: true, - showSubTotals: true, - reverseLayout: true, - reverseSubLayout: true, + totals: { + col: { + ...config, + showGrandTotals: true, + showSubTotals: true, + reverseLayout: true, + reverseSubLayout: true, + }, + }, }); s2.setDataCfg({ @@ -386,8 +390,8 @@ describe('Total Group Dimension Test', () => { const { colNodes, colsHierarchy } = s2.facet.layoutResult; expect(colsHierarchy.height).toEqual(90); - expect(colNodes).toHaveLength(4); - expect(colNodes.find((node) => node.value === '总计')).toBeFalsy(); + expect(colNodes).toHaveLength(7); + expect(colNodes.find((node) => node.value === '总计')).toBeTruthy(); expect(colNodes.find((node) => node.value === '小计')).toBeFalsy(); }, ); diff --git a/packages/s2-core/__tests__/unit/cell/header-cell-spec.ts b/packages/s2-core/__tests__/unit/cell/header-cell-spec.ts index 222099fdb1..b03c2ee04c 100644 --- a/packages/s2-core/__tests__/unit/cell/header-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/cell/header-cell-spec.ts @@ -181,13 +181,13 @@ describe('header cell formatter test', () => { test('should render col header sort icons', () => { s2.options.showDefaultHeaderActionIcon = true; jest.spyOn(s2, 'isValueInCols').mockImplementationOnce(() => true); + const showSortIconSpy = jest + .spyOn(ColCell.prototype, 'showSortIcon') + .mockImplementation(() => true); + const colCell = new ColCell(colNode, s2); // @ts-ignore colCell.actionIcons = []; - const showSortIconSpy = jest - // @ts-ignore - .spyOn(colCell, 'showSortIcon') - .mockImplementation(() => true); // @ts-ignore colCell.drawActionIcons(); // @ts-ignore diff --git a/packages/s2-core/__tests__/unit/cell/series-number-cell-spec.ts b/packages/s2-core/__tests__/unit/cell/series-number-cell-spec.ts index 333c450d5f..ad98677ad7 100644 --- a/packages/s2-core/__tests__/unit/cell/series-number-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/cell/series-number-cell-spec.ts @@ -8,7 +8,7 @@ import { PivotSheet, SpreadSheet } from '@/sheet-type'; const MockPivotSheet = PivotSheet as unknown as jest.Mock; const MockPivotDataSet = PivotDataSet as unknown as jest.Mock; -describe('header cell formatter test', () => { +describe('series number cell formatter test', () => { const root = new Node({ id: `root`, key: '', value: '', children: [] }); const rowNode = new Node({ diff --git a/packages/s2-core/__tests__/unit/utils/cell/data-cell-spec.ts b/packages/s2-core/__tests__/unit/utils/cell/data-cell-spec.ts index 2f89a8119a..b5855030fe 100644 --- a/packages/s2-core/__tests__/unit/utils/cell/data-cell-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/cell/data-cell-spec.ts @@ -1,10 +1,14 @@ -import { EXTRA_FIELD, VALUE_FIELD } from '@/common/constant/field'; +import { EXTRA_FIELD, VALUE_FIELD, CellTypes } from '@/common'; import type { FilterDataItemCallback, MappingDataItemCallback, } from '@/common/interface/basic'; import type { Data, MultiData } from '@/common/interface/s2DataConfig'; -import { handleDataItem } from '@/utils/cell/data-cell'; +import { + handleDataItem, + getDataCellId, + isDataCell, +} from '@/utils/cell/data-cell'; describe('Display Data Item Callback Test', () => { test('should return origin data value when there is no callback', () => { @@ -68,4 +72,30 @@ describe('Display Data Item Callback Test', () => { 'price-rc': -0.3, }); }); + + test('#getDataCellId()', () => { + expect(getDataCellId('', '')).toEqual('-'); + expect(getDataCellId('rowId', 'colId')).toEqual('rowId-colId'); + expect(getDataCellId('rowId', '')).toEqual('rowId-'); + expect(getDataCellId('', 'colId')).toEqual('-colId'); + }); + + test('#isDataCell()', () => { + expect( + isDataCell({ + id: '', + rowIndex: 0, + colIndex: 0, + type: CellTypes.DATA_CELL, + }), + ).toBeTruthy(); + expect( + isDataCell({ + id: '', + rowIndex: 0, + colIndex: 0, + type: CellTypes.COL_CELL, + }), + ).toBeFalsy(); + }); }); diff --git a/packages/s2-core/src/common/constant/basic.ts b/packages/s2-core/src/common/constant/basic.ts index a237b86c20..7c68866636 100644 --- a/packages/s2-core/src/common/constant/basic.ts +++ b/packages/s2-core/src/common/constant/basic.ts @@ -52,6 +52,8 @@ export const KEY_COL_REAL_WIDTH_INFO = 'col-real-width-info'; export const ROOT_ID = 'root'; export const ID_SEPARATOR = '[&]'; +// 数值单元格 ID 分割符 TODO: 2.0 版本使用唯一标识 +export const DATA_CELL_ID_SEPARATOR = '-'; export const EMPTY_PLACEHOLDER = '-'; export const PADDING_TOP = 0; diff --git a/packages/s2-core/src/common/interface/interaction.ts b/packages/s2-core/src/common/interface/interaction.ts index 1f67b44ae2..1832b6a3fa 100644 --- a/packages/s2-core/src/common/interface/interaction.ts +++ b/packages/s2-core/src/common/interface/interaction.ts @@ -38,6 +38,8 @@ export interface CellMeta { rowIndex: number; type: CellTypes; rowQuery?: Record; + rowId?: string; + colId?: string; [key: string]: unknown; } diff --git a/packages/s2-core/src/interaction/brush-selection/data-cell-brush-selection.ts b/packages/s2-core/src/interaction/brush-selection/data-cell-brush-selection.ts index dabfa25ae2..463f869e01 100644 --- a/packages/s2-core/src/interaction/brush-selection/data-cell-brush-selection.ts +++ b/packages/s2-core/src/interaction/brush-selection/data-cell-brush-selection.ts @@ -10,6 +10,7 @@ import { import type { BrushRange, CellMeta, ViewMeta } from '../../common/interface'; import { afterSelectDataCells } from '../../utils/interaction/select-event'; import { TableDataCell } from '../../cell/table-data-cell'; +import { getDataCellId } from '../../utils'; import { BaseBrushSelection } from './base-brush-selection'; export class DataCellBrushSelection extends BaseBrushSelection { @@ -82,7 +83,7 @@ export class DataCellBrushSelection extends BaseBrushSelection { metas.push({ colIndex, rowIndex, - id: `${rowId}-${colId}`, + id: getDataCellId(rowId, colId), type: CellTypes.DATA_CELL, rowId, colId, diff --git a/packages/s2-core/src/utils/cell/data-cell.ts b/packages/s2-core/src/utils/cell/data-cell.ts index e0859dd627..e1cb2a9f89 100644 --- a/packages/s2-core/src/utils/cell/data-cell.ts +++ b/packages/s2-core/src/utils/cell/data-cell.ts @@ -1,12 +1,11 @@ -import { isEqual, forEach, isBoolean } from 'lodash'; +import { forEach, isEqual } from 'lodash'; import type { DataCell } from '../../cell'; -import type { SpreadSheet } from '../../sheet-type'; import { + CellTypes, + DATA_CELL_ID_SEPARATOR, EXTRA_FIELD, - VALUE_FIELD, InteractionStateName, - CellTypes, - EMPTY_PLACEHOLDER, + VALUE_FIELD, } from '../../common/constant'; import type { CellMeta, @@ -15,6 +14,7 @@ import type { MappingDataItemCallback, S2CellType, } from '../../common/interface'; +import type { SpreadSheet } from '../../sheet-type'; export const handleDataItem = ( data: Data, @@ -37,8 +37,8 @@ export const includeCell = (cells: CellMeta[], currentCell: S2CellType) => { }); }; -export const getDataCellId = (rowIndex: string, colIndex: string) => { - return `${rowIndex}${EMPTY_PLACEHOLDER}${colIndex}`; +export const getDataCellId = (rowId: string, colId: string) => { + return `${rowId}${DATA_CELL_ID_SEPARATOR}${colId}`; }; export const shouldUpdateBySelectedCellsHighlight = (s2: SpreadSheet) => { diff --git a/packages/s2-core/src/utils/export/copy.ts b/packages/s2-core/src/utils/export/copy.ts index ff39f66f7e..9a56e3f301 100644 --- a/packages/s2-core/src/utils/export/copy.ts +++ b/packages/s2-core/src/utils/export/copy.ts @@ -2,9 +2,11 @@ import { escape, every, filter, + first, forEach, isEmpty, isNil, + last, map, max, orderBy, @@ -14,8 +16,8 @@ import { import type { ColCell, HeaderCell, RowCell } from '../../cell'; import { CellTypes, + DATA_CELL_ID_SEPARATOR, CopyType, - EMPTY_PLACEHOLDER, EXTRA_FIELD, ID_SEPARATOR, InteractionStateName, @@ -354,6 +356,7 @@ export const getSelectedCellsMeta = (cells: CellMeta[]) => { }); return twoDimDataArray; }; + const processTableColSelected = ( spreadsheet: SpreadSheet, selectedCols: CellMeta[], @@ -631,7 +634,10 @@ const getDataWithHeaderMatrix = ( ): Copyable => { const colMatrix = zip( ...map(cellMetaMatrix[0], (cellMeta) => { - const colId = cellMeta.id.split(EMPTY_PLACEHOLDER)?.[1] ?? ''; + const colId = + cellMeta?.colId || + last(cellMeta?.id?.split(DATA_CELL_ID_SEPARATOR)) || + ''; return getHeaderMeasureFieldNames( getHeaderMeasureFields(colId), spreadsheet, @@ -640,7 +646,10 @@ const getDataWithHeaderMatrix = ( ); const rowMatrix = map(cellMetaMatrix, (cellsMeta) => { - const rowId = cellsMeta[0].id.split(EMPTY_PLACEHOLDER)?.[0] ?? ''; + const rowId = + cellsMeta?.[0]?.rowId || + first(cellsMeta?.[0]?.id?.split(DATA_CELL_ID_SEPARATOR)) || + ''; return getHeaderMeasureFieldNames( getHeaderMeasureFields(rowId), spreadsheet,