Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,16 @@ exports[`Pivot Table Core Data Process should copy format total(root) data in gr
`;

exports[`Pivot Table Core Data Process should copy normal data with format header in grid mode 1`] = `
" 家具-类
桌子-子类
数量
" type 家具-类
sub_type 桌子-子类
province 城市 数量
浙江省-省 杭州市-市 7789元"
`;

exports[`Pivot Table Core Data Process should copy normal data with format header in grid mode 2`] = `
" 家具-类
桌子-子类
数量
" type 家具-类
sub_type 桌子-子类
province 城市 数量
浙江省-省 小计 18375元"
`;

Expand Down
4 changes: 2 additions & 2 deletions packages/s2-core/__tests__/unit/utils/export/copy-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ describe('Pivot Table Core Data Process', () => {
});

expect(getCopyPlainContent(s2)).toEqual(
`\t\t家具\r\n\t\t桌子\r\n\t\tnumber\r\n浙江省\t杭州市\t7789`,
`\ttype\t家具\r\n\tsub_type\t桌子\r\nprovince\tcity\tnumber\r\n浙江省\t杭州市\t7789`,
);

// 小计节点
Expand All @@ -937,7 +937,7 @@ describe('Pivot Table Core Data Process', () => {
stateName: InteractionStateName.SELECTED,
});
expect(getCopyPlainContent(s2)).toEqual(
`\t\t家具\r\n\t\t桌子\r\n\t\tnumber\r\n浙江省\t小计\t18375`,
`\ttype\t家具\r\n\tsub_type\t桌子\r\nprovince\tcity\tnumber\r\n浙江省\t小计\t18375`,
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,10 @@ export class PivotDataCellCopy extends BaseDataCellCopy {
// 带表头复制
const rowMatrix = this.getRowMatrix();
const colMatrix = this.getColMatrix();
const cornerMatrix = this.getCornerMatrix(rowMatrix);

return this.matrixTransformer(
assembleMatrix({ rowMatrix, colMatrix, dataMatrix }),
assembleMatrix({ rowMatrix, colMatrix, dataMatrix, cornerMatrix }),
this.config.separator,
);
};
Expand All @@ -414,9 +415,10 @@ export class PivotDataCellCopy extends BaseDataCellCopy {
// 带表头复制
const rowMatrix = this.getRowMatrix();
const colMatrix = this.getColMatrix();
const cornerMatrix = this.getCornerMatrix(rowMatrix);

return this.matrixTransformer(
assembleMatrix({ rowMatrix, colMatrix, dataMatrix }),
assembleMatrix({ rowMatrix, colMatrix, dataMatrix, cornerMatrix }),
this.config.separator,
);
}
Expand Down