Skip to content

Commit

Permalink
Merge branch 'antvis:next' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
Create-Peace authored Oct 23, 2024
2 parents f588a6b + c40bbf9 commit f8504cb
Show file tree
Hide file tree
Showing 43 changed files with 553 additions and 237 deletions.
10 changes: 10 additions & 0 deletions packages/s2-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# [@antv/s2-v2.0.0-next.29](https://github.com/antvis/S2/compare/@antv/s2-v2.0.0-next.28...@antv/s2-v2.0.0-next.29) (2024-10-12)


### Bug Fixes

* 修复存在字段标记的 icon 时, 紧凑模式列宽计算错误出现省略号的问题 ([#2920](https://github.com/antvis/S2/issues/2920)) ([75acbfe](https://github.com/antvis/S2/commit/75acbfe4540bf8dc702a3a068c214c9217239261))
* 修复拖拽列宽后, 默认的自定义列宽失效 close [#2910](https://github.com/antvis/S2/issues/2910) ([#2915](https://github.com/antvis/S2/issues/2915)) ([8302fe4](https://github.com/antvis/S2/commit/8302fe40bc475baecf72ba463ac948d33a391a3f))
* 修复自定义列宽对虚拟数值列不生效 ([#2921](https://github.com/antvis/S2/issues/2921)) ([c53cea4](https://github.com/antvis/S2/commit/c53cea4a2fa2d7b18939abfb984629a94eab936d))
* 调整分割线的颜色绘制逻辑, 优化和单元格边框颜色不一致的问题 ([#2919](https://github.com/antvis/S2/issues/2919)) ([3f766d0](https://github.com/antvis/S2/commit/3f766d02b14bf6d6ebac34b302a0232a58afe500))

# [@antv/s2-v2.0.0-next.28](https://github.com/antvis/S2/compare/@antv/s2-v2.0.0-next.27...@antv/s2-v2.0.0-next.28) (2024-09-18)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,38 @@ Array [
exports[`SpreadSheet Custom Cell Style Tests PivotSheet Custom Cell Style Tests #ColCell should get custom col cell style by field id 1`] = `
Array [
Object {
"height": 60,
"id": "root[&]浙江",
"width": 149.5,
"height": 30,
"id": "root[&]",
"width": 199.5,
},
Object {
"height": 30,
"id": "root[&]浙江[&]义乌",
"height": 300,
"id": "root[&]笔[&]price",
"width": 50,
},
Object {
"height": 300,
"id": "root[&]笔[&]cost",
"width": 149.5,
},
]
`;

exports[`SpreadSheet Custom Cell Style Tests PivotSheet Custom Cell Style Tests #ColCell should get custom col cell style by value field 1`] = `
Array [
Object {
"height": 30,
"id": "root[&]浙江[&]杭州",
"id": "root[&]笔",
"width": 199.5,
},
Object {
"height": 300,
"id": "root[&]笔[&]price",
"width": 50,
},
Object {
"height": 300,
"id": "root[&]笔[&]cost",
"width": 149.5,
},
]
Expand Down Expand Up @@ -135,6 +155,46 @@ Array [
]
`;

exports[`SpreadSheet Custom Cell Style Tests PivotSheet Custom Cell Style Tests #RowCell should get custom row cell style by extra field 1`] = `
Array [
Object {
"height": 1200,
"id": "root[&]浙江",
"width": 149.5,
},
Object {
"height": 600,
"id": "root[&]浙江[&]义乌",
"width": 149.5,
},
Object {
"height": 300,
"id": "root[&]浙江[&]义乌[&]price",
"width": 50,
},
Object {
"height": 300,
"id": "root[&]浙江[&]义乌[&]cost",
"width": 50,
},
Object {
"height": 600,
"id": "root[&]浙江[&]杭州",
"width": 149.5,
},
Object {
"height": 300,
"id": "root[&]浙江[&]杭州[&]price",
"width": 50,
},
Object {
"height": 300,
"id": "root[&]浙江[&]杭州[&]cost",
"width": 50,
},
]
`;

exports[`SpreadSheet Custom Cell Style Tests PivotSheet Custom Cell Style Tests #RowCell should get custom row cell style by field 1`] = `
Array [
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,17 +563,13 @@ Object {
},
"splitLine": Object {
"borderDash": Array [],
"horizontalBorderColor": "#3471F9",
"horizontalBorderColorOpacity": 0.2,
"horizontalBorderWidth": 2,
"shadowColors": Object {
"left": "rgba(0,0,0,0.1)",
"right": "rgba(0,0,0,0)",
},
"shadowWidth": 8,
"showShadow": true,
"verticalBorderColor": "#5286FA",
"verticalBorderColorOpacity": 0.25,
"verticalBorderWidth": 2,
},
}
Expand Down Expand Up @@ -1142,17 +1138,13 @@ Object {
},
"splitLine": Object {
"borderDash": Array [],
"horizontalBorderColor": "#7899ff",
"horizontalBorderColorOpacity": 0.2,
"horizontalBorderWidth": 2,
"shadowColors": Object {
"left": "rgba(0,0,0,0.1)",
"right": "rgba(0,0,0,0)",
},
"shadowWidth": 8,
"showShadow": true,
"verticalBorderColor": "#7899ff",
"verticalBorderColorOpacity": 0.25,
"verticalBorderWidth": 2,
},
}
Expand Down Expand Up @@ -1721,17 +1713,13 @@ Object {
},
"splitLine": Object {
"borderDash": Array [],
"horizontalBorderColor": "#326EF4",
"horizontalBorderColorOpacity": 0.2,
"horizontalBorderWidth": 2,
"shadowColors": Object {
"left": "rgba(0,0,0,0.1)",
"right": "rgba(0,0,0,0)",
},
"shadowWidth": 8,
"showShadow": true,
"verticalBorderColor": "#326EF4",
"verticalBorderColorOpacity": 0.25,
"verticalBorderWidth": 2,
},
}
Expand Down Expand Up @@ -2300,17 +2288,13 @@ Object {
},
"splitLine": Object {
"borderDash": Array [],
"horizontalBorderColor": "#BAC1CC",
"horizontalBorderColorOpacity": 0.2,
"horizontalBorderWidth": 2,
"shadowColors": Object {
"left": "rgba(0,0,0,0.1)",
"right": "rgba(0,0,0,0)",
},
"shadowWidth": 8,
"showShadow": true,
"verticalBorderColor": "#BAC1CC",
"verticalBorderColorOpacity": 0.25,
"verticalBorderWidth": 2,
},
}
Expand Down Expand Up @@ -2879,17 +2863,13 @@ Object {
},
"splitLine": Object {
"borderDash": Array [],
"horizontalBorderColor": "#326EF4",
"horizontalBorderColorOpacity": 0.2,
"horizontalBorderWidth": 2,
"shadowColors": Object {
"left": "rgba(0,0,0,0.1)",
"right": "rgba(0,0,0,0)",
},
"shadowWidth": 8,
"showShadow": true,
"verticalBorderColor": "#326EF4",
"verticalBorderColorOpacity": 0.25,
"verticalBorderWidth": 2,
},
}
Expand Down Expand Up @@ -3458,17 +3438,13 @@ Object {
},
"splitLine": Object {
"borderDash": Array [],
"horizontalBorderColor": "#326EF4",
"horizontalBorderColorOpacity": 0.2,
"horizontalBorderWidth": 2,
"shadowColors": Object {
"left": "rgba(0,0,0,0.1)",
"right": "rgba(0,0,0,0)",
},
"shadowWidth": 8,
"showShadow": true,
"verticalBorderColor": "#326EF4",
"verticalBorderColorOpacity": 0.25,
"verticalBorderWidth": 2,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('Compare Layout Tests', () => {
expect(colLeafNodeWidthList).toEqual([182]);
});

test.skip.each([
test.each([
{ showDefaultHeaderActionIcon: true },
{ showDefaultHeaderActionIcon: false },
])(
Expand Down Expand Up @@ -137,11 +137,11 @@ describe('Compare Layout Tests', () => {

expect(dataCellWidthList).toEqual(
options.showDefaultHeaderActionIcon
? [197, 197, 197, 197, 116, 116, 116, 116, 81, 81, 81, 81]
: [197, 197, 197, 197, 116, 116, 116, 116, 62, 62, 62, 62],
? [207, 207, 207, 207, 108, 108, 108, 108, 83, 83, 83, 83]
: [207, 207, 207, 207, 108, 108, 108, 108, 67, 67, 67, 67],
);
expect(colLeafNodeWidthList).toEqual(
options.showDefaultHeaderActionIcon ? [197, 116, 81] : [197, 116, 62],
options.showDefaultHeaderActionIcon ? [207, 108, 83] : [207, 108, 67],
);
},
);
Expand Down
46 changes: 45 additions & 1 deletion packages/s2-core/__tests__/spreadsheet/custom-cell-style-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,30 @@ describe('SpreadSheet Custom Cell Style Tests', () => {
expect(mapNodeSize(s2.facet.getRowNodes())).toMatchSnapshot();
});

test('should get custom row cell style by extra field', async () => {
s2.setDataCfg({
fields: {
valueInCols: false,
},
});

s2.setOptions({
style: {
rowCell: {
widthByField: {
[EXTRA_FIELD]: 50,
},
heightByField: {
[EXTRA_FIELD]: 300,
},
},
},
});
await s2.render();

expect(mapNodeSize(s2.facet.getRowNodes())).toMatchSnapshot();
});

test('should not get custom row cell style if not leaf node by field', async () => {
const width = 100;
const height = 200;
Expand Down Expand Up @@ -306,7 +330,27 @@ describe('SpreadSheet Custom Cell Style Tests', () => {
});
await s2.render();

expect(mapNodeSize(s2.facet.getRowNodes())).toMatchSnapshot();
expect(mapNodeSize(s2.facet.getColNodes())).toMatchSnapshot();
});

test('should get custom col cell style by value field', async () => {
const priceValueField = `price`;

s2.setOptions({
style: {
colCell: {
widthByField: {
[priceValueField]: 50,
},
heightByField: {
[priceValueField]: 300,
},
},
},
});
await s2.render();

expect(mapNodeSize(s2.facet.getColNodes())).toMatchSnapshot();
});

test('should not get custom col cell style if not leaf node by field', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Object {
"heightByField": null,
"maxLines": 1,
"textOverflow": "ellipsis",
"width": null,
"width": undefined,
"widthByField": Object {
"testFieldId": 5,
},
Expand All @@ -34,7 +34,7 @@ Object {
"heightByField": null,
"maxLines": 1,
"textOverflow": "ellipsis",
"width": null,
"width": undefined,
"widthByField": Object {
"testField": 5,
},
Expand All @@ -48,9 +48,10 @@ Object {
"heightByField": null,
"maxLines": 1,
"textOverflow": "ellipsis",
"width": null,
"width": undefined,
"widthByField": Object {
"testFieldId": 5,
"test-cell-a": 5,
"test-cell-b": 5,
},
"wordWrap": true,
}
Expand All @@ -62,7 +63,7 @@ Object {
"heightByField": null,
"maxLines": 1,
"textOverflow": "ellipsis",
"width": null,
"width": undefined,
"widthByField": Object {
"test-cell-a": 5,
"test-cell-b": 5,
Expand All @@ -73,7 +74,7 @@ Object {

exports[`Interaction Row Column Resize Tests should get multiple vertical filed resize style by field for selected resize type 1`] = `
Object {
"height": null,
"height": undefined,
"heightByField": Object {
"test-cell-a": 2,
"test-cell-b": 2,
Expand Down Expand Up @@ -123,7 +124,7 @@ Object {

exports[`Interaction Row Column Resize Tests should get vertical filed resize style by field for current resize type 1`] = `
Object {
"height": null,
"height": undefined,
"heightByField": Object {
"testFieldId": 2,
},
Expand All @@ -137,9 +138,10 @@ Object {

exports[`Interaction Row Column Resize Tests should get vertical filed resize style by field for selected resize type 1`] = `
Object {
"height": null,
"height": undefined,
"heightByField": Object {
"testFieldId": 2,
"test-cell-a": 2,
"test-cell-b": 2,
},
"maxLines": 1,
"showTreeLeafNodeAlignDot": false,
Expand All @@ -163,6 +165,20 @@ Object {
}
`;

exports[`Interaction Row Column Resize Tests should not effect default resize style by field for selected resize type 1`] = `
Object {
"height": 30,
"heightByField": null,
"maxLines": 1,
"textOverflow": "ellipsis",
"width": 50,
"widthByField": Object {
"testFieldId": 5,
},
"wordWrap": true,
}
`;

exports[`Interaction Row Column Resize Tests should rerender by resize col cell 1`] = `
Object {
"height": 30,
Expand Down
Loading

0 comments on commit f8504cb

Please sign in to comment.