Skip to content

Commit

Permalink
Merge branch 'master' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
wjgogogo committed Dec 4, 2023
2 parents 24f3041 + d2c1cd3 commit 791e1ad
Show file tree
Hide file tree
Showing 14 changed files with 125 additions and 89 deletions.
7 changes: 7 additions & 0 deletions packages/s2-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* **perf:** 优化 dataset 数据结构转化性能 ([#2379](https://github.com/antvis/S2/issues/2379)) ([924da53](https://github.com/antvis/S2/commit/924da531cab013211f12fafadb4aa3f402738f2f)), closes [#2353](https://github.com/antvis/S2/issues/2353) [#2355](https://github.com/antvis/S2/issues/2355) [#2360](https://github.com/antvis/S2/issues/2360) [#2355](https://github.com/antvis/S2/issues/2355) [#2362](https://github.com/antvis/S2/issues/2362) [#2363](https://github.com/antvis/S2/issues/2363) [#2255](https://github.com/antvis/S2/issues/2255) [#2357](https://github.com/antvis/S2/issues/2357) [#2255](https://github.com/antvis/S2/issues/2255) [#2359](https://github.com/antvis/S2/issues/2359) [#2364](https://github.com/antvis/S2/issues/2364) [#2370](https://github.com/antvis/S2/issues/2370)

# [@antv/s2-v1.53.0-alpha.1](https://github.com/antvis/S2/compare/@antv/s2-v1.52.0...@antv/s2-v1.53.0-alpha.1) (2023-11-17)
# [@antv/s2-v1.52.1](https://github.com/antvis/S2/compare/@antv/s2-v1.52.0...@antv/s2-v1.52.1) (2023-12-01)


### Bug Fixes
Expand All @@ -27,6 +28,12 @@

* the pivot table supports freezing the first row as a whole ([dd61601](https://github.com/antvis/S2/commit/dd61601b7aab505eafeaa5ad8faf98baea295ed4))

* 修复中英文标点符号 ([#2442](https://github.com/antvis/S2/issues/2442)) ([17a2d00](https://github.com/antvis/S2/commit/17a2d00f13ff1db4cc8236176b2a26c5212a2dbd))
* 修复交叉模式下 行序号位置不正确&总计行未添加行序号 ([#2412](https://github.com/antvis/S2/issues/2412)) ([55359af](https://github.com/antvis/S2/commit/55359af64d08492298187c2ef15d0a780440d1fd))
* 修复维度缺失部分维值时, 行维值以及对应的数值展示错误 ([#2436](https://github.com/antvis/S2/issues/2436)) ([1207fa0](https://github.com/antvis/S2/commit/1207fa041d1ab31f68785ff683a90954dda5c05c))
* 修复缺失维度所生成的 query 多了 empty extra value 字段 ([#2444](https://github.com/antvis/S2/issues/2444)) ([3439da8](https://github.com/antvis/S2/commit/3439da88eb8f72d1cf00a6190eda6d4cd2a8c187))
* 修复隐藏列总计时行总计也被隐藏问题 ([#2417](https://github.com/antvis/S2/issues/2417)) ([3b771c0](https://github.com/antvis/S2/commit/3b771c0df436ef3687f6e20968cf5aa20680e732))

# [@antv/s2-v1.52.0](https://github.com/antvis/S2/compare/@antv/s2-v1.51.2...@antv/s2-v1.52.0) (2023-11-10)


Expand Down
171 changes: 94 additions & 77 deletions packages/s2-core/__tests__/spreadsheet/miss-dimension-values-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ const s2Options: S2Options = {
},
reverseLayout: false,
reverseSubLayout: false,
subTotalsDimensions: [
'2d7feabd-76a2-4c11-8f24-79764af936b4',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec',
],
subTotalsDimensions: ['first', 'second'],
},
col: {
showGrandTotals: false,
Expand All @@ -45,133 +42,142 @@ const s2Options: S2Options = {
const testDataCfg: S2DataConfig = {
meta: [
{
field: '2d7feabd-76a2-4c11-8f24-79764af936b4',
field: 'first',
name: '一级维度',
},
{
field: '30b4b32d-d69a-4772-b7f9-84cd54cf0cec',
field: 'second',
name: '二级维度',
},
{
field: 'c5ce4e54-795a-42b3-9cc8-e8b685da44ee',
field: 'third',
name: '三级维度',
},
{
field: 'number',
name: '数值',
},
],
fields: {
rows: [
'2d7feabd-76a2-4c11-8f24-79764af936b4',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec',
],
rows: ['first', 'second', 'third'],
columns: [],
values: ['c5ce4e54-795a-42b3-9cc8-e8b685da44ee'],
values: ['number'],
valueInCols: true,
},
data: [
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '总计',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 1732771,
first: '总计',
number: 1732771,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '维值-1',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '维值-2',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 172245,
first: '维值-1',
second: '维值-2',
third: '维度-3',
number: 172245,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '维值-1',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '维值-2',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 12222,
first: '维值-1',
second: '维值-2',
third: '维度-3',
number: 12222,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '维值-1',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '维值-3',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 11111,
first: '维值-1',
second: '维值-3',
third: '维值-3',
number: 11111,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '维值-1',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '维值-3',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 11111,
first: '维值-1',
second: '维值-3',
third: '维度-3',
number: 11111,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '维值-1',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 456,
first: '维值-1',
number: 456,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '测试-1',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '测试-2',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 12,
first: '测试-1',
second: '测试-2',
third: '维度-3',
number: 12,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '测试-1',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '测试-2',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 4444567,
first: '测试-1',
second: '测试-2',
third: '维度-3',
number: 4444567,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '测试-1',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '测试-3',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 111233,
first: '测试-1',
second: '测试-3',
number: 111233,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '测试-1',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '测试-3',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 785222,
first: '测试-1',
second: '测试-3',
number: 785222,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '测试-1',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '测试-4',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 6455644,
first: '测试-1',
second: '测试-4',
third: '维度-3',
number: 6455644,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '测试-1',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '测试-4',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 289898,
first: '测试-1',
second: '测试-4',
number: 289898,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '测试-1',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '测试-5',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 2222,
first: '测试-1',
second: '测试-5',
number: 2222,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '测试-1',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '测试-5',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 1111,
first: '测试-1',
second: '测试-5',
third: '维度-3',
number: 1111,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '测试-1',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 125555,
first: '测试-1',
number: 125555,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '测试-6',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '测试-x',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 409090,
first: '测试-6',
second: '测试-x',
number: 409090,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '测试-6',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '测试-x',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 111111,
first: '测试-6',
second: '测试-x',
number: 111111,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '测试-6',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '测试-7',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 5555,
first: '测试-6',
second: '测试-7',
number: 5555,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '测试-6',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '测试-7',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 67878,
first: '测试-6',
second: '测试-7',
number: 67878,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '测试-6',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '测试-8',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 53445.464,
first: '测试-6',
second: '测试-8',
number: 53445.464,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '测试-6',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec': '测试-8',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 456.464,
first: '测试-6',
second: '测试-8',
number: 456.464,
},
{
'2d7feabd-76a2-4c11-8f24-79764af936b4': '测试-6',
'c5ce4e54-795a-42b3-9cc8-e8b685da44ee': 123.416,
first: '测试-6',
number: 123.416,
},
],
};
Expand All @@ -186,7 +192,6 @@ describe('Miss Dimension Values Tests', () => {

test('should get correctly empty dimension values', () => {
const emptyDimensionValueNode = s2.getRowNodes()[0].children[0];

expect(emptyDimensionValueNode.value).toEqual(EMPTY_FIELD_VALUE);
expect(emptyDimensionValueNode.id).toEqual(
`root[&]总计[&]${EMPTY_FIELD_VALUE}`,
Expand All @@ -208,6 +213,18 @@ describe('Miss Dimension Values Tests', () => {
);
});

test('should generate correct query for empty node', () => {
const emptyDimensionValueNode1 = s2.facet.layoutResult.rowNodes[0];
expect(emptyDimensionValueNode1.query).toEqual({
first: '总计',
});

const emptyDimensionValueNode2 = s2.facet.layoutResult.rowNodes[1];
expect(emptyDimensionValueNode2.query).toEqual({
first: '总计',
});
});

test('should get correctly dimension data and ignore empty dimension value', () => {
const emptyDimensionValueNode = s2.getRowNodes()[0].children[0];

Expand All @@ -224,8 +241,8 @@ describe('Miss Dimension Values Tests', () => {
expect(emptyDimensionDataCell.getMeta().fieldValue).toEqual(1732771);
expect(data[0][ORIGIN_FIELD]).toMatchInlineSnapshot(`
Object {
"2d7feabd-76a2-4c11-8f24-79764af936b4": "总计",
"c5ce4e54-795a-42b3-9cc8-e8b685da44ee": 1732771,
"first": "总计",
"number": 1732771,
}
`);
expect(dimensionValues).toMatchInlineSnapshot(`
Expand Down
6 changes: 4 additions & 2 deletions packages/s2-core/__tests__/unit/common/i18n/index-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,29 @@ describe('I18n Test', () => {
setLang('en_US');
expect(i18n('小计')).toEqual('Total');
expect(i18n('总计')).toEqual('Total');
expect(i18n('总和')).toEqual('SUM');
expect(i18n('总和')).toEqual('(SUM)');
expect(i18n('项')).toEqual('items');
expect(i18n('已选择')).toEqual('selected');
expect(i18n('序号')).toEqual('Index');
expect(i18n('度量')).toEqual('Measure');
expect(i18n('数值')).toEqual('Measure');
expect(i18n('共计')).toEqual('Total');
expect(i18n('条')).toEqual('');
expect(i18n(',')).toEqual(', ');
});

test('should show Chinese text when set lang to zh', () => {
setLang('zh_CN');
expect(i18n('小计')).toEqual('小计');
expect(i18n('总计')).toEqual('总计');
expect(i18n('总和')).toEqual('总和');
expect(i18n('总和')).toEqual('(总和)');
expect(i18n('项')).toEqual('项');
expect(i18n('已选择')).toEqual('已选择');
expect(i18n('序号')).toEqual('序号');
expect(i18n('度量')).toEqual('度量');
expect(i18n('数值')).toEqual('数值');
expect(i18n('共计')).toEqual('共计');
expect(i18n('条')).toEqual('条');
expect(i18n(',')).toEqual(',');
});
});
3 changes: 2 additions & 1 deletion packages/s2-core/src/common/i18n/en_US.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const EN_US = {
小计: 'Total',
总计: 'Total',
总和: 'SUM',
总和: '(SUM)',
: 'items',
已选择: 'selected',
序号: 'Index',
Expand All @@ -16,4 +16,5 @@ export const EN_US = {
升序: 'ASC',
降序: 'DESC',
不排序: 'No order',
',': ', ',
};
3 changes: 2 additions & 1 deletion packages/s2-core/src/common/i18n/zh_CN.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const ZH_CN = {
小计: '小计',
总计: '总计',
总和: '总和',
总和: '(总和)',
: '项',
已选择: '已选择',
序号: '序号',
Expand All @@ -16,4 +16,5 @@ export const ZH_CN = {
降序: '降序',
组内降序: '组内降序',
不排序: '不排序',
',': ',',
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { EMPTY_FIELD_VALUE } from '../../common/constant';
import type { Node } from '../../facet/layout/node';

export function getDimsCondition(parent: Node, force?: boolean) {
Expand All @@ -8,7 +9,7 @@ export function getDimsCondition(parent: Node, force?: boolean) {
* 当为表格布局时,小计行的内容是“小计”不需要作为筛选条件
* 当为树状布局时,force可以强行指定小计行,即父类目作为筛选条件
*/
if (!p.isTotalRoot || force) {
if ((!p.isTotalRoot || force) && p.value !== EMPTY_FIELD_VALUE) {
cond[p.key] = p.value;
}
p = p.parent;
Expand Down
2 changes: 2 additions & 0 deletions packages/s2-react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
* **perf:** 优化 dataset 数据结构转化性能 ([#2379](https://github.com/antvis/S2/issues/2379)) ([924da53](https://github.com/antvis/S2/commit/924da531cab013211f12fafadb4aa3f402738f2f)), closes [#2353](https://github.com/antvis/S2/issues/2353) [#2355](https://github.com/antvis/S2/issues/2355) [#2360](https://github.com/antvis/S2/issues/2360) [#2355](https://github.com/antvis/S2/issues/2355) [#2362](https://github.com/antvis/S2/issues/2362) [#2363](https://github.com/antvis/S2/issues/2363) [#2255](https://github.com/antvis/S2/issues/2255) [#2357](https://github.com/antvis/S2/issues/2357) [#2255](https://github.com/antvis/S2/issues/2255) [#2359](https://github.com/antvis/S2/issues/2359) [#2364](https://github.com/antvis/S2/issues/2364) [#2370](https://github.com/antvis/S2/issues/2370)

# [@antv/s2-react-v1.44.3-alpha.1](https://github.com/antvis/S2/compare/@antv/s2-react-v1.44.2...@antv/s2-react-v1.44.3-alpha.1) (2023-11-17)
# [@antv/s2-react-v1.44.3](https://github.com/antvis/S2/compare/@antv/s2-react-v1.44.2...@antv/s2-react-v1.44.3) (2023-12-01)


### Bug Fixes

* **copy:** 修复刷选复制行列头时, 数值单元格未格式化 & 存在省略号时未复制原始值 ([#2410](https://github.com/antvis/S2/issues/2410)) ([708fde4](https://github.com/antvis/S2/commit/708fde479bb48b941445b3adaf1f56cf5cb6b301))
* 修复中英文标点符号 ([#2442](https://github.com/antvis/S2/issues/2442)) ([17a2d00](https://github.com/antvis/S2/commit/17a2d00f13ff1db4cc8236176b2a26c5212a2dbd))

# [@antv/s2-react-v1.44.2](https://github.com/antvis/S2/compare/@antv/s2-react-v1.44.1...@antv/s2-react-v1.44.2) (2023-11-10)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ export const StrategySheetDataTooltip: React.FC<CustomTooltipProps> = ({
)}
{rowDescription && (
<div className={tooltipCls('description')}>
{i18n('说明')}: {rowDescription}
{i18n('说明')}
{rowDescription}
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export const StrategySheetRowTooltip: React.FC<CustomTooltipProps> = ({
<div className={tooltipCls('value')}>{rowName}</div>
{description && (
<div className={tooltipCls('description')}>
{i18n('说明')}: {description}
{i18n('说明')}
{description}
</div>
)}
</div>
Expand Down
Loading

0 comments on commit 791e1ad

Please sign in to comment.