-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
57 changed files
with
3,851 additions
and
1,347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/s2-core/__tests__/bugs/__snapshots__/issue-2684-spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`PivotSheet Special Dimension Values Copy Tests should correctly copy data with header 1`] = ` | ||
Array [ | ||
Object { | ||
"content": " 两片罐事业部 宝翼制罐 河北制罐 成都制罐 哈尔滨制罐 | ||
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", | ||
"type": "text/plain", | ||
}, | ||
Object { | ||
"content": "<meta charset=\\"utf-8\\"><table><tbody><tr><td></td><td>两片罐事业部</td><td>宝翼制罐</td><td>河北制罐</td><td>成都制罐</td><td>哈尔滨制罐</td></tr><tr><td></td><td>dq</td><td>dq</td><td>dq</td><td>dq</td><td>dq</td></tr><tr><td>2018年-三月</td><td>53332</td><td></td><td></td><td></td><td></td></tr><tr><td>2019年-三月</td><td>53332</td><td></td><td></td><td></td><td></td></tr><tr><td>2023年-三月</td><td>53332</td><td>67456</td><td>53332</td><td>66293.333333</td><td>97192.090909</td></tr><tr><td>2023年-四月</td><td>67454</td><td>0</td><td>70442.733333</td><td>56665</td><td>100535.760606</td></tr><tr><td>2023年-五月</td><td>23566</td><td>-10000</td><td>73786.40303</td><td>65554</td><td>103879.430303</td></tr><tr><td>2023年-六月</td><td>67456</td><td>22222</td><td>77130.072727</td><td>53332</td><td>107223.1</td></tr><tr><td>2023年-七月</td><td>0</td><td>39998</td><td>80473.742424</td><td>70442.733333</td><td>61292.833333</td></tr><tr><td>2023年-八月</td><td>0</td><td>48877</td><td>83817.412121</td><td>73786.40303</td><td>66293.333333</td></tr><tr><td>2023年-九月</td><td>22222</td><td>49999</td><td>87161.081818</td><td>77130.072727</td><td>56665</td></tr></tbody></table>", | ||
"type": "text/html", | ||
}, | ||
] | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* 透视表维值含有 "-", 复制数据时表头缺失 | ||
* @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: { | ||
copy: { | ||
enable: true, | ||
withHeader: true, | ||
withFormat: true, | ||
}, | ||
brushSelection: { | ||
dataCell: true, | ||
rowCell: true, | ||
colCell: true, | ||
}, | ||
multiSelection: true, | ||
}, | ||
}; | ||
|
||
describe('PivotSheet Special Dimension Values Copy Tests', () => { | ||
let s2: SpreadSheet; | ||
|
||
beforeEach(async () => { | ||
s2 = createPivotSheet(s2Options); | ||
s2.setDataCfg(mockDataConfig); | ||
await s2.render(); | ||
}); | ||
|
||
test('should correctly copy data with header', () => { | ||
const { rowLeafNodes, colLeafNodes } = s2.facet.getLayoutResult(); | ||
const cells = s2.facet.getDataCells().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(); | ||
}); | ||
}); |
Oops, something went wrong.