Skip to content

Commit

Permalink
chore: 合并master 到 next 分支 (#2036)
Browse files Browse the repository at this point in the history
* docs: 修复错误 API 文档格式 (#1976)

* fix: 修复 enableCopy 和 hideMeasureColumn 都开启为 true 时,复制报错问题 (#1984)

* fix: 修复 enableCopy 和 hideMeasureColumn 都开启为 true 时,复制报错问题

* test: 添加单测

Co-authored-by: zishang <[email protected]>

* feat: 暴露afterRealCellRender,这样能够更灵活的使用datacell (#1970)

Co-authored-by: 杨骥 <[email protected]>

* feat: 实现树状模式下可复制 (#1986)

* feat: 树状结构下复制,非叶子节点也需要被复制到

* fix: 修复存在空数据时复制错误的问题

* test: 添加树状结构下复制的单测

* chore: 删除无用代码

* chore: 删除无用代码

Co-authored-by: zishang <[email protected]>

* feat: 适配链接跳转的判断方式 (#1983)

* fix: 适配链接跳转的判断方式

* fix: 增加点击链接返回参数 id

* test: 完善链接跳转测试

* fix: 透传整个cellData

* docs: 补充链接跳转文档

* test: 修复链接跳转单测

* test: 修复链接跳转单测

Co-authored-by: gaofuhong.gfh <[email protected]>

* chore: 🤖 更新 changelog 文件 (#1989)

* feat: 增加 linkFields 参数传入类型 (#1992)

* feat: 增加 linkFields 参数传入类型

* docs: 补充 linkFields 文档

* docs: 补充 linkFields 文档

* fix: 抽取判断是否需要添加链接为公共方法

* fix: 修改公共方法名

Co-authored-by: gaofuhong.gfh <[email protected]>

* refactor:  优化智能反色功能 (#1974)

* feat: 优化智能反色需求

* feat: 优化智能反色需求

Co-authored-by: zishang <[email protected]>

* docs: 官网自定义目录树链接跳转 demo (#2001)

feat: 官网自定义目录树链接跳转 demo

Co-authored-by: gaofuhong.gfh <[email protected]>

* fix: gui icon 加载完成后,增加检测步骤,避免无意义的渲染 warning (#1997)

* docs: 更新列分组demo配图 (#1998)

* docs: 修复自定义 schema 示例demo (#2000)

* feat: 添加字段标记中,定制柱状图的长度的功能 (filedValue) (#2002)

* feat: 添加字段标记中,定制柱状图的长度的功能

* chore: 添加字段标记中,定制柱状图的长度的demo

* test: 添加字段标记中,定制柱状图的长度的单测

Co-authored-by: zishang <[email protected]>

* fix: 明细表紧凑模式宽度计算错误 (#2006)

* fix: 明细表紧凑模式宽度计算错误

* test: 补充紧凑模式测试用例

* test: table-facet测试异常

Co-authored-by: 沫君 <[email protected]>

* chore: 🤖 更新 changelog 文件 (#2005)

* fix: 明细表linkField失效 (#2007)

* fix: 明细表linkField失效

* test: 补充测试用例

Co-authored-by: 沫君 <[email protected]>

* chore: 🤖 更新 changelog 文件 (#2008)

* feat: 子弹图为空时使用placeholder占位 (#2010)

Co-authored-by: 沫君 <[email protected]>

* fix: 列头label存在数组,复制导出列头层级补齐错误 (#1990)

* fix: 列头label存在数组,层级补齐错误
当headers存在数组,但不是每一列都存在数组时,仅需要对header[0]为数组的项进行补齐(当列各层级都是string类型时会补齐过多的空格)

* test: 添加单测

* feat: selected cell highlight (#1878)

* feat: upgrade selectedCellHighlight option & 修复 selectedCellHighlight 单元格因滚动状态失效的问题

* feat: selectedCellHighlight option 复制功能

* fix: selectedCellHighlight 为 false 的情况

* fix: 修复单测报错

* feat: 补充单测

* feat: selectedCellHighlight 配置项补充文档

* refactor: 调整 BaseDataSet.getRowData 为抽象方法

* refactor: remove unused code

* refactor: 调整 selectedCellHighlight option 实现逻辑

* feat: 修改文档 & react playground

* refactor: 调整 selectedCellHighlight option 复制实现

* feat: 调整单测

* fix: type error

* refactor: selectedCellHighlight option 调整数据单元格点击事件 headerCells 存储逻辑

* feat: selectedCellHighlight option 统一刷选的交互 & afterSelectDataCells 函数提取

* refactor: remove duplicate constant

* refactor: selectedCellHighlight option selectedCellHighlightAdaptor 调整为 getSelectedCellHighlight

* fix: lint error

* fix: unit test

Co-authored-by: 嘤嘤嘤 <[email protected]>
Co-authored-by: stone <[email protected]>

* fix: bullet占位符绘制错误 (#2022)

Co-authored-by: 沫君 <[email protected]>

* fix: 修复单元格宽高为0时的无意义渲染 (#2024)

* fix: 修复单元格宽高为0时的无意义渲染

* fix: 修复 facet 处理过程中忽略 0 的情况

* test: 修复单测

* test: 添加宽高为 0 时的单元格测试

* refactor: 在 base cell 中应用 shouldInit

* fix : 修复点击行列头无法整行高亮的问题 (#2025)

* fix: 修复点击行列头无法整行高亮的问题

* test: 添加修复点击行列头无法整行高亮的问题的单测

* docs: 完善 selectedCellHighlight 相关文档

* docs: 完善 selectedCellHighlight 相关文档

Co-authored-by: zishang <[email protected]>

* docs: 替换antgroup主站 (#2029)

Co-authored-by: 沫君 <[email protected]>

* chore: 🤖 更新 changelog 文件 (#2028)

* fix(layout): 修复无列头时行头对应的角头不显示 close #1929 (#2026)

* fix(layout): 修复无列头时行头对应的角头不显示 close #1929

* test: 修复测试

* refactor: rowCells 重命名为 currentRow,避免与行头 rowCell 定义冲突 (#2032)

Co-authored-by: zishang <[email protected]>

* chore: 修复严格模式下 eslint 错误的问题

* test: 修复linkField测试

* chore: 修复 lint 问题

* test: 修复 cornerBBox 单测问题

* test: 修复 link jump 单测

* test: table-sheet 单测

* fix: 明细表列头clip错误

* chore: compressed action 优化

* fix: 修复列头隐藏时角头不显示

* test: g-mini-charts 单测文字处理

* test: 修复 next 版本,不将 border width 作为 Interval 宽度。

* test: 更新 corner 单测

* fix: 明细表compact模式宽度计算错误

* test: 修改单测,添加border width

Co-authored-by: Jinke Li <[email protected]>
Co-authored-by: zishang <[email protected]>
Co-authored-by: yangji <[email protected]>
Co-authored-by: 杨骥 <[email protected]>
Co-authored-by: GaoFuhong <[email protected]>
Co-authored-by: gaofuhong.gfh <[email protected]>
Co-authored-by: Wenjun Xu <[email protected]>
Co-authored-by: 嘤嘤嘤 <[email protected]>
Co-authored-by: 刘嘉一 <[email protected]>
Co-authored-by: 沫君 <[email protected]>
Co-authored-by: 照明胧 <[email protected]>
Co-authored-by: LHC8888 <[email protected]>
  • Loading branch information
13 people authored Jan 16, 2023
1 parent 5db92c8 commit f7a9c6c
Show file tree
Hide file tree
Showing 93 changed files with 2,141 additions and 493 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/compressed-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ jobs:
- uses: preactjs/compressed-size-action@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
pattern: "./packages/**/dist/**/*.{js,css}"
pattern: "./packages/{s2-core,s2-react,s2-vue}/dist/**/*.{js,css}"
build-script: "build:umd"
clean-script: "clean"
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
. "$(dirname -- "$0")/_/husky.sh"
. "$(dirname -- "$0")/common.sh"

yarn lint:type
pnpm lint:type
59 changes: 59 additions & 0 deletions packages/s2-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,65 @@
# [@antv/s2-v2.0.0-next.3](https://github.com/antvis/S2/compare/@antv/s2-v2.0.0-next.2...@antv/s2-v2.0.0-next.3) (2022-12-16)

### Bug Fixes
# [@antv/s2-v1.40.0](https://github.com/antvis/S2/compare/@antv/s2-v1.39.1...@antv/s2-v1.40.0) (2023-01-03)


### Bug Fixes

* bullet占位符绘制错误 ([#2022](https://github.com/antvis/S2/issues/2022)) ([c95c446](https://github.com/antvis/S2/commit/c95c446219216b190bf6af632104edd125a82ff3))
* 修复单元格宽高为0时的无意义渲染 ([#2024](https://github.com/antvis/S2/issues/2024)) ([9f952fd](https://github.com/antvis/S2/commit/9f952fd4bfd280b657b589e5912399f89bb1f0ea))
* 列头label存在数组,复制导出列头层级补齐错误 ([#1990](https://github.com/antvis/S2/issues/1990)) ([ec62409](https://github.com/antvis/S2/commit/ec62409b688c5dd5e39a93f5b292d909496ed830))


### Features

* selected cell highlight ([#1878](https://github.com/antvis/S2/issues/1878)) ([3e11a37](https://github.com/antvis/S2/commit/3e11a37bf94f758379ba2819ec5d8b3251708814))
* 子弹图为空时使用placeholder占位 ([#2010](https://github.com/antvis/S2/issues/2010)) ([8d28254](https://github.com/antvis/S2/commit/8d28254aa9aa29d9b2a9e24efb21f185cb5ffe4c))

# [@antv/s2-v1.39.1](https://github.com/antvis/S2/compare/@antv/s2-v1.39.0...@antv/s2-v1.39.1) (2022-12-20)


### Bug Fixes

* 明细表linkField失效 ([#2007](https://github.com/antvis/S2/issues/2007)) ([122552b](https://github.com/antvis/S2/commit/122552bdd25aa538cfd38a6210e9979698c13188))
* 明细表紧凑模式宽度计算错误 ([#2006](https://github.com/antvis/S2/issues/2006)) ([89f5c9e](https://github.com/antvis/S2/commit/89f5c9eb7719834ce9a55d340bf04415639cc277))

# [@antv/s2-v1.39.0](https://github.com/antvis/S2/compare/@antv/s2-v1.38.0...@antv/s2-v1.39.0) (2022-12-19)


### Bug Fixes

* gui icon 加载完成后,增加检测步骤,避免无意义的渲染 warning ([#1997](https://github.com/antvis/S2/issues/1997)) ([6f13aa4](https://github.com/antvis/S2/commit/6f13aa43d8910f9ed83d59a9c958b26a0eb163d6))


### Features

* 添加字段标记中,定制柱状图的长度的功能 (filedValue) ([#2002](https://github.com/antvis/S2/issues/2002)) ([457e5e7](https://github.com/antvis/S2/commit/457e5e7989ce460e445f46925eaee79b49f56615))

# [@antv/s2-v1.38.0](https://github.com/antvis/S2/compare/@antv/s2-v1.37.0...@antv/s2-v1.38.0) (2022-12-16)


### Features

* 增加 linkFields 参数传入类型 ([#1992](https://github.com/antvis/S2/issues/1992)) ([66bce2a](https://github.com/antvis/S2/commit/66bce2ae77635b530058f56b0545bd5558c119e1))
* 新增链接跳转配置 ([5e08055](https://github.com/antvis/S2/commit/5e08055b52a125e75cbc41bb748d247ef25ba016))

# [@antv/s2-v1.37.0](https://github.com/antvis/S2/compare/@antv/s2-v1.36.0...@antv/s2-v1.37.0) (2022-12-09)


### Bug Fixes

* **tooltip:** 修复自定义操作菜单传入自定义 ReactNode 不显示 ([#1969](https://github.com/antvis/S2/issues/1969)) ([3eff993](https://github.com/antvis/S2/commit/3eff9932438cc95093686c03510b57648ff44391))
* 修复 enableCopy 和 hideMeasureColumn 都开启为 true 时,复制报错问题 ([#1984](https://github.com/antvis/S2/issues/1984)) ([528d2b6](https://github.com/antvis/S2/commit/528d2b6b6b912f790449aaef015fc27d2e0e33c9))


### Features

* 实现树状模式下可复制 ([#1986](https://github.com/antvis/S2/issues/1986)) ([96ccb1e](https://github.com/antvis/S2/commit/96ccb1ee14908fc1daf82d1eccb3bd852e642f7d))
* 暴露afterRealCellRender,这样能够更灵活的使用datacell ([#1970](https://github.com/antvis/S2/issues/1970)) ([66c5ab9](https://github.com/antvis/S2/commit/66c5ab9992c51b475be8acaf9a198d49f3114a49))
* 适配链接跳转的判断方式 ([#1983](https://github.com/antvis/S2/issues/1983)) ([2a26259](https://github.com/antvis/S2/commit/2a2625971bcefd119d2e2a280608d1acf56b5d32))

# [@antv/s2-v1.36.0](https://github.com/antvis/S2/compare/@antv/s2-v1.35.1...@antv/s2-v1.36.0) (2022-12-02)

* 暂时修复g版本冲突问题 ([#2003](https://github.com/antvis/S2/issues/2003)) ([1de7ec2](https://github.com/antvis/S2/commit/1de7ec215bc96c28e7493c8a32fe1764fd08cb2d))

Expand Down
111 changes: 111 additions & 0 deletions packages/s2-core/__tests__/spreadsheet/corner-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import * as simpleDataConfig from 'tests/data/simple-data.json';
import { DEFAULT_STYLE, type SpreadSheet } from '../../src';
import { createPivotSheet } from '../util/helpers';

describe('PivotSheet Corner Tests', () => {
let s2: SpreadSheet;

beforeEach(() => {
s2 = createPivotSheet({
width: 300,
height: 300,
});
s2.render();
});

afterEach(() => {
s2.destroy();
});

// https://github.com/antvis/S2/issues/1929
test('should render row corner when columns is empty and measure hidden', () => {
s2.setDataCfg({
...simpleDataConfig,
fields: {
...simpleDataConfig.fields,
columns: [],
},
});
s2.setOptions({
style: {
colCell: {
hideValue: true,
},
},
});
s2.render();

const cornerNodes = s2.facet.getCornerNodes();
const { colsHierarchy } = s2.facet.layoutResult;

expect(colsHierarchy.width).toEqual(0);
expect(colsHierarchy.height).toEqual(DEFAULT_STYLE.colCell!.height);
expect(colsHierarchy.sampleNodeForLastLevel!.y).toEqual(0);
expect(colsHierarchy.sampleNodeForLastLevel!.height).toEqual(
DEFAULT_STYLE.colCell!.height,
);
expect(cornerNodes).toHaveLength(2);
});

test('should render row corner when measure hidden', () => {
s2.setOptions({
style: {
colCell: {
hideValue: true,
},
},
});
s2.render();

const cornerNodes = s2.facet.getCornerNodes();
const { colsHierarchy } = s2.facet.layoutResult;

expect(colsHierarchy.width).toEqual(100);
expect(colsHierarchy.height).toEqual(DEFAULT_STYLE.colCell!.height);
expect(colsHierarchy.sampleNodeForLastLevel!.y).toEqual(0);
expect(colsHierarchy.sampleNodeForLastLevel!.height).toEqual(
DEFAULT_STYLE.colCell!.height,
);
expect(cornerNodes).toHaveLength(2);
});

test('should render row corner when columns and values is empty', () => {
s2.setDataCfg({
...simpleDataConfig,
fields: {
...simpleDataConfig.fields,
columns: [],
values: [],
},
});
s2.render();

const cornerNodes = s2.facet.getCornerNodes();
const { colsHierarchy } = s2.facet.layoutResult;

expect(colsHierarchy.width).toEqual(0);
expect(colsHierarchy.height).toEqual(0);
expect(colsHierarchy.sampleNodeForLastLevel).toBeNull();
expect(cornerNodes).toHaveLength(2);
});

test('should not render row corner when fields is empty', () => {
s2.setDataCfg({
...simpleDataConfig,
fields: {
rows: [],
columns: [],
values: [],
},
});
s2.render();

const cornerNodes = s2.facet.getCornerNodes();
const { colsHierarchy } = s2.facet.layoutResult;

expect(colsHierarchy.width).toEqual(0);
expect(colsHierarchy.height).toEqual(0);
expect(colsHierarchy.sampleNodeForLastLevel).toBeNull();
expect(cornerNodes).toHaveLength(0);
});
});
3 changes: 3 additions & 0 deletions packages/s2-core/__tests__/spreadsheet/row-link-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ describe('Row Text Link Tests', () => {

expect(linkFieldJump).toBeCalledWith({
field: 'province',
cellData: rowNode,
record: {
province: '浙江',
type: '笔',
Expand All @@ -125,6 +126,7 @@ describe('Row Text Link Tests', () => {

expect(linkFieldJump).toBeCalledWith({
field: 'city',
cellData: rowNode,
record: {
province: '浙江',
city: '义乌1',
Expand Down Expand Up @@ -152,6 +154,7 @@ describe('Row Text Link Tests', () => {

expect(linkFieldJump).toBeCalledWith({
field: 'province',
cellData: rowNode,
record: {
province: '四川',
type: '笔',
Expand Down
41 changes: 33 additions & 8 deletions packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { getContainer, getMockData, sleep } from 'tests/util/helpers';
import { get, last } from 'lodash';
import {
ColCell,
DeviceType,
ResizeType,
TableSheet,
type RawData,
type S2DataConfig,
type S2Options,
ResizeType,
ColCell,
TableDataCell,
} from '@/index';
import type { TableFacet } from '@/facet';

const data = getMockData(
'../../../s2-react/__tests__/data/tableau-supermarket.csv',
Expand Down Expand Up @@ -184,6 +187,10 @@ describe('TableSheet normal spec', () => {
const s2 = new TableSheet(getContainer(), dataCfg, options);
s2.render();

const getLastColCell = () =>
last(s2.getColumnNodes())!.belongsCell as ColCell;
const preColWidth = getLastColCell().getMeta().width;

await sleep(30);

const { x, width, top } = s2.getCanvasElement().getBoundingClientRect();
Expand All @@ -198,9 +205,11 @@ describe('TableSheet normal spec', () => {

await sleep(300); // 等待绘制响应

const resizeLength = 100;

document.dispatchEvent(
new MouseEvent('mousemove', {
clientX: x + width + 100,
clientX: x + width + resizeLength,
clientY: top + 25,
bubbles: true,
}),
Expand All @@ -209,18 +218,34 @@ describe('TableSheet normal spec', () => {

document.dispatchEvent(
new PointerEvent('pointerup', {
clientX: x + width + 100,
clientX: x + width + resizeLength,
clientY: top + 25,
bubbles: true,
}),
);

await sleep(300);

const columnNodes = s2.getColumnNodes();
const lastColumnCell = columnNodes[columnNodes.length - 1]
.belongsCell as ColCell;
const currentColWidth = getLastColCell().getMeta().width;
expect(currentColWidth).toBeGreaterThanOrEqual(resizeLength + preColWidth);
});

test('should render link shape', () => {
const s2 = new TableSheet(getContainer(), dataCfg, {
...options,
frozenRowCount: 0,
frozenColCount: 0,
frozenTrailingColCount: 0,
frozenTrailingRowCount: 0,
} as S2Options);
s2.render();

expect(lastColumnCell.getMeta().width).toBe(198);
const orderIdDataCell = (
(s2.facet as TableFacet).frozenColGroup.children as TableDataCell[]
).find((item) => item.getMeta().valueField === 'order_id');

expect(get(orderIdDataCell, 'linkFieldShape')).toBeDefined();

s2.destroy();
});
});
2 changes: 2 additions & 0 deletions packages/s2-core/__tests__/unit/cell/col-cell-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ describe('Col Cell Tests', () => {
id: 1,
fieldValue: 'fieldValue',
value: 'value',
width: 100,
height: 10,
} as unknown as Node;

const headerConfig: Partial<ColHeaderConfig> = {
Expand Down
Loading

0 comments on commit f7a9c6c

Please sign in to comment.