Skip to content

Commit

Permalink
Merge pull request #1174 from VisActor/release/0.20.1
Browse files Browse the repository at this point in the history
[Auto release] release 0.20.1
  • Loading branch information
fangsmile committed Feb 29, 2024
2 parents 0bad745 + 5a96241 commit 8b62bbd
Show file tree
Hide file tree
Showing 57 changed files with 610 additions and 271 deletions.
2 changes: 1 addition & 1 deletion common/config/rush/version-policies.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"0.20.0","mainProject":"@visactor/vtable","nextBump":"minor"}]
[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"0.20.1","mainProject":"@visactor/vtable","nextBump":"patch"}]
16 changes: 16 additions & 0 deletions docs/assets/api/en/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,22 @@ Note: ListTable specific interface
getTableIndexByRecordIndex: (recordIndex: number) => number;
```

## getRecordIndexByCell(Function)

Get the number of data in the current cell in the data source.

If it is a table in tree mode, an array will be returned, such as [1,2], the 3rd item in the children of the 2nd item in the data source.

** ListTable proprietary **

```
/** Get the number of the data in the current cell in the data source.
* If it is a table in tree mode, an array will be returned, such as [1,2], the 3rd item in the children of the 2nd item in the data source
* Note: ListTable specific interface */
getRecordIndexByCell(col: number, row: number): number | number[]
** ListTable proprietary **
```

## getTableIndexByField(Function)

Get the index row number or column number displayed in the table according to the field of the data source (Related to transposition, the non-transposition obtains the row number, and the transposed table obtains the column number).
Expand Down
16 changes: 16 additions & 0 deletions docs/assets/api/zh/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,22 @@ setRecords(records: Array<any>, sort?: SortState | SortState[]) //** 基本表
getTableIndexByRecordIndex: (recordIndex: number) => number;
```

## getRecordIndexByCell(Function)

获取当前单元格的数据是数据源中的第几条。

如果是树形模式的表格,将返回数组,如[1,2] 数据源中第2条数据中children中的第3条。

** ListTable 专有 **

```
/** 获取当前单元格的数据是数据源中的第几条。
* 如果是树形模式的表格,将返回数组,如[1,2] 数据源中第2条数据中children中的第3条
* 注:ListTable特有接口 */
getRecordIndexByCell(col: number, row: number): number | number[]
** ListTable 专有 **
```

## getTableIndexByField(Function)

根据数据源的 field 获取显示到表格中的 index 行号或者列号(与转置相关,非转置获取的是行号,转置表获取的是列号)。
Expand Down
27 changes: 27 additions & 0 deletions docs/assets/changelog/en/release.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
# v0.20.0

2024-02-23


**🆕 New feature**

- **@visactor/vtable**: add aggregation for list table column
- **@visactor/vtable**: add api getAggregateValuesByField
- **@visactor/vtable**: add custom aggregation
- **@visactor/vtable**: chartSpec support function [#1115](https://github.com/VisActor/VTable/issues/1115)
- **@visactor/vtable**: add filter data config [#607](https://github.com/VisActor/VTable/issues/607)

**🐛 Bug fix**

- **@visactor/vtable**: edit right frozen cell input position error
- **@visactor/vtable**: mouseleave_cell event trigger [#1112](https://github.com/VisActor/VTable/issues/1112)
- **@visactor/vtable**: fix cellBgColor judgement in isCellHover()
- **@visactor/vtable**: fix custom merge cell computed height&width
- **@visactor/vtable**: fix content position update problem
- **@visactor/vtable**: merge cell update in setDropDownMenuHighlight()
- **@visactor/vtable**: fix react-vtable display error in react strict mode [#990](https://github.com/VisActor/VTable/issues/990)



[more detail about v0.20.0](https://github.com/VisActor/VTable/releases/tag/v0.20.0)

# v0.19.1

2024-02-06
Expand Down
26 changes: 26 additions & 0 deletions docs/assets/changelog/zh/release.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
# v0.20.0

2024-02-23


**🆕 新增功能**

- **@visactor/vtable**:添加列表列的聚合
- **@visactor/vtable**:添加 api getAggregateValuesByField
- **@visactor/vtable**:添加自定义聚合
- **@visactor/vtable**:chartSpec 支持函数 [#1115](https://github.com/VisActor/VTable/issues/1115)
- **@visactor/vtable**:添加基本表格的过滤能力 [#607](https://github.com/VisActor/VTable/issues/607)

**🐛 功能修复**

- **@visactor/vtable**:编辑右冻结单元格输入位置错误
- **@visactor/vtable**:mouseleave_cell 事件触发器 [#1112](https://github.com/VisActor/VTable/issues/1112)
- **@visactor/vtable**:修复 isCellHover() 中的 cellBgColor 判断
- **@visactor/vtable**:修复自定义合并单元计算的高度和宽度
- **@visactor/vtable**:修复内容位置更新问题
- **@visactor/vtable**:在 setDropDownMenuHighlight() 中合并单元格更新
- **@visactor/vtable**:修复react严格模式下的react-vtable显示错误[#990](https://github.com/VisActor/VTable/issues/990)


[更多详情请查看 v0.20.0](https://github.com/VisActor/VTable/releases/tag/v0.20.0)

# v0.19.1

2024-02-06
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ category: examples
group: list-table-data-analysis
title: Set multiple aggregation and aggregation summary methods for the same column of data
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/list-table-multiple-aggregation.png
link: '../guide/table_type/Pivot_table/list_table_dataAnalysis'
link: '../guide/data_analysis/list_table_dataAnalysis'
option: ListTable-columns-text#aggregation(Aggregation%20%7C%20CustomAggregation%20%7C%20Array)
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ category: examples
group: list-table-data-analysis
title: List Table data aggregation summary
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/list-table-aggregation.png
link: '../guide/table_type/Pivot_table/list_table_dataAnalysis'
link: '../guide/data_analysis/list_table_dataAnalysis'
option: ListTable-columns-text#aggregation(Aggregation%20%7C%20CustomAggregation%20%7C%20Array)
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ category: examples
group: list-table-data-analysis
title: List table data filtering
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/list-table-filter.gif
link: '../guide/table_type/Pivot_table/list_table_dataAnalysis'
link: '../guide/data_analysis/list_table_dataAnalysis'
---

# List table data filtering
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ category: examples
group: list-table-data-analysis
title: 同一列数据设置多种聚合汇总方式
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/list-table-multiple-aggregation.png
link: '../guide/table_type/Pivot_table/list_table_dataAnalysis'
link: '../guide/data_analysis/list_table_dataAnalysis'
option: ListTable-columns-text#aggregation(Aggregation%20%7C%20CustomAggregation%20%7C%20Array)
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ category: examples
group: list-table-data-analysis
title: 基本表格数据聚合分析
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/list-table-aggregation.png
link: '../guide/table_type/Pivot_table/list_table_dataAnalysis'
link: '../guide/data_analysis/list_table_dataAnalysis'
option: ListTable-columns-text#aggregation(Aggregation%20%7C%20CustomAggregation%20%7C%20Array)
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ category: examples
group: list-table-data-analysis
title: 基本表格数据过滤
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/list-table-filter.gif
link: '../guide/table_type/Pivot_table/list_table_dataAnalysis'
link: '../guide/data_analysis/list_table_dataAnalysis'
---

# 基本表格数据过滤
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# How to cancel the bubbling of the table mousedown event

## Problem Description

In my business scenario, I need to drag the entire table to move the position. However, if the mouse point is dragged on the cell, it will trigger the box selection interaction of the table. In this way, I do not expect to drag the entire table. When the mouse point is clicked, Then respond to the entire table dragging behavior in the blank area of the table.

Based on this demand background, how to determine whether the click is on a cell or a blank area of the table?

## solution

This problem can be handled in VTable by listening to the `mousedown_cell` event, but it should be noted that VTable internally listens to pointer events!

Therefore, if you cancel bubbling directly, you can only cancel the pointerdown event.
```
tableInstance.on('mousedown_cell', arg => {
arg.event.stopPropagation();
});
```
Therefore, you need to listen to mousedown again to determine the organization event. For correct processing, you can see the following example:

## Code Example

```javascript
const tableInstance = new VTable.ListTable(option);
window.tableInstance = tableInstance;
let isPointerDownOnTable = false;
tableInstance.on('mousedown_cell', arg => {
isPointerDownOnTable = true;
setTimeout(() => {
isPointerDownOnTable = false;
}, 0);
arg.event?.stopPropagation();
});
tableInstance.getElement().addEventListener('mousedown', e => {
if (isPointerDownOnTable) {
e.stopPropagation();
}
});
```
## Related documents
- [Tutorial](https://visactor.io/vtable/guide/Event/event_list)
- [github](https://github.com/VisActor/VTable)
7 changes: 7 additions & 0 deletions docs/assets/faq/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@
"zh": "20.如何在Vue中使用Vtable?",
"en": "20.How to use VTable in Vue?"
}
},
{
"path": "21-How to cancel the bubbling of the table event",
"title": {
"zh": "21.怎么取消表格mousedown事件的冒泡?",
"en": "21.How to cancel the bubbling of the table event?"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 怎么取消表格mousedown事件的冒泡

## 问题描述

在我的业务场景中需要对表格整体进行拖拽来移动位置,但是如果鼠标点在单元格上拖拽会触发表格的框选交互,这样我就预期不进行整表拖拽了,当鼠标点在表格空白区域再响应整表拖拽行为。

基于这个需求背景,怎么判断是点击在了单元格上还是表格空白区域呢?

## 解决方案

在 VTable 中可以通过监听`mousedown_cell`事件来处理这个问题,不过需要注意的是VTable内部都是监听的pointer事件哦!

所以如果直接取消冒泡,也仅能取消pointerdown事件。
```
tableInstance.on('mousedown_cell', arg => {
arg.event.stopPropagation();
});
```
所以需要再监听mousedown来判断组织事件,正确处理可以看下面示例:

## 代码示例

```javascript
const tableInstance = new VTable.ListTable(option);
window.tableInstance = tableInstance;
let isPointerDownOnTable = false;
tableInstance.on('mousedown_cell', arg => {
isPointerDownOnTable = true;
setTimeout(() => {
isPointerDownOnTable = false;
}, 0);
arg.event?.stopPropagation();
});
tableInstance.getElement().addEventListener('mousedown', e => {
if (isPointerDownOnTable) {
e.stopPropagation();
}
});
```
## 相关文档
- [教程](https://visactor.io/vtable/guide/Event/event_list)
- [github](https://github.com/VisActor/VTable)
2 changes: 1 addition & 1 deletion packages/react-vtable/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/react-vtable",
"version": "0.20.0",
"version": "0.20.1",
"description": "The react version of VTable",
"keywords": [
"react",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-vtable/src/components/component/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type MenuProps = {
/** 内置下拉菜单的全局设置项 目前只针对基本表格有效 会对每个表头单元格开启默认的下拉菜单功能。代替原来的option.dropDownMenu*/
defaultHeaderMenuItems?: TYPES.MenuListItem[];
/** 右键菜单。代替原来的option.contextmenu */
contextMenuItems?: TYPES.MenuListItem[] | ((field: string, row: number) => TYPES.MenuListItem[]);
contextMenuItems?: TYPES.MenuListItem[] | ((field: string, row: number, col: number) => TYPES.MenuListItem[]);
/** 设置选中状态的菜单。代替原来的option.dropDownMenuHighlight */
dropDownMenuHighlight?: TYPES.DropDownMenuHighlightInfo[];
} & BaseComponentProps;
Expand Down
10 changes: 7 additions & 3 deletions packages/react-vtable/src/tables/base-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ const BaseTable: React.FC<Props> = React.forwardRef((props, ref) => {
!isEqual(eventsBinded.current.records, props.records, { skipFunction: skipFunctionDiff })
) {
eventsBinded.current = props;
tableContext.current.table.setRecords(props.records);
tableContext.current.table.setRecords(props.records, {
restoreHierarchyState: props.option.restoreHierarchyState
});
handleTableRender();
}
return;
Expand All @@ -202,7 +204,7 @@ const BaseTable: React.FC<Props> = React.forwardRef((props, ref) => {
if (
!isEqual(newOption, prevOption.current, { skipFunction: skipFunctionDiff }) ||
// tableContext.current.isChildrenUpdated
!isEqual(newOptionFromChildren, optionFromChildren.current)
!isEqual(newOptionFromChildren, optionFromChildren.current, { skipFunction: skipFunctionDiff })
) {
prevOption.current = newOption;
optionFromChildren.current = newOptionFromChildren;
Expand All @@ -212,7 +214,9 @@ const BaseTable: React.FC<Props> = React.forwardRef((props, ref) => {
handleTableRender();
} else if (hasRecords && !isEqual(props.records, prevRecords.current, { skipFunction: skipFunctionDiff })) {
prevRecords.current = props.records;
tableContext.current.table.setRecords(props.records);
tableContext.current.table.setRecords(props.records, {
restoreHierarchyState: props.option.restoreHierarchyState
});
handleTableRender();
}
// tableContext.current = {
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable-editors/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vtable-editors",
"version": "0.20.0",
"version": "0.20.1",
"description": "",
"sideEffects": false,
"main": "cjs/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable-export/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vtable-export",
"version": "0.20.0",
"version": "0.20.1",
"description": "The export util of VTable",
"author": {
"name": "VisActor",
Expand Down
45 changes: 45 additions & 0 deletions packages/vtable/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
{
"name": "@visactor/vtable",
"entries": [
{
"version": "0.20.1",
"tag": "@visactor/vtable_v0.20.1",
"date": "Thu, 29 Feb 2024 11:57:42 GMT",
"comments": {
"none": [
{
"comment": "fix: hideColumnsSubheader with three levels show error #1105\n\n"
},
{
"comment": "feat: add api getRecordIndexByCell #1121\n\n"
},
{
"comment": "refactor: rename resize_column_end event arguments #1129\n\n"
},
{
"comment": "refactor: api return value type\n\n"
},
{
"comment": "refactor: setRecords support restoreHierarchyState #1148\n\n"
},
{
"comment": "fix: customlayout flex render error #1163\n\n"
},
{
"comment": "refactor: vtable not stop event bubble #892"
},
{
"comment": "fix: when scroll tooltip hide #905\n\n"
},
{
"comment": "fix: fix axis innerOffset"
},
{
"comment": "fix-contextMenuItems-add-col-param"
},
{
"comment": "fix: add skipFunctionDiff in react-vtable"
},
{
"comment": "refactor: remove Circular dependency\n\n"
}
]
}
},
{
"version": "0.20.0",
"tag": "@visactor/vtable_v0.20.0",
Expand Down
Loading

0 comments on commit 8b62bbd

Please sign in to comment.