Skip to content

Commit

Permalink
Merge pull request #899 from VisActor/release/0.17.9
Browse files Browse the repository at this point in the history
[Auto release] release 0.17.9
  • Loading branch information
fangsmile authored Jan 10, 2024
2 parents ccf50d4 + 0b72828 commit ebb7fa3
Show file tree
Hide file tree
Showing 59 changed files with 3,363 additions and 2,654 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.17.8","mainProject":"@visactor/vtable","nextBump":"patch"}]
[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"0.17.9","mainProject":"@visactor/vtable","nextBump":"patch"}]
9 changes: 9 additions & 0 deletions docs/assets/api/en/event/CellAddress.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ The type definition for CellAddress is:
interface CellAddress {
col: number;
row: number;
}
```

{{ target: CellAddressWithBound }}
The type definition for CellAddressWithBound is:
```
interface CellAddressWithBound {
col: number;
row: number;
rect?: RectProps;
x?: number;
y?: number;
Expand Down
15 changes: 15 additions & 0 deletions docs/assets/api/en/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ Get the selected cell information, and the returned result is a two-dimensional
getSelectedCellInfos(): CellInfo[][] | null;
```

{{ use: CellInfo() }}

## clearSelected(Function)

Clear the selection of all cells.
Expand Down Expand Up @@ -716,6 +718,19 @@ Change the value of a cell:
changeCellValue: (col: number, row: number, value: string | number | null) => void;
```

## changeCellValues(Function)
Change the value of cells in batches:

```
/**
* Batch update data of multiple cells
* @param col The starting column number of pasted data
* @param row The starting row number of pasted data
* @param values Data array of multiple cells
*/
changeCellValues(startCol: number, startRow: number, values: string[][])
```

## getEditor(Function)

Get the editor for the cell configuration
Expand Down
9 changes: 9 additions & 0 deletions docs/assets/api/zh/event/CellAddress.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ CellAddress的类型定义为:
interface CellAddress {
col: number;
row: number;
}
```

{{ target: CellAddressWithBound }}
CellAddressWithBound的类型定义为:
```
interface CellAddressWithBound {
col: number;
row: number;
rect?: RectProps;
x?: number;
y?: number;
Expand Down
18 changes: 18 additions & 0 deletions docs/assets/api/zh/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ setRecords(records: Array<any>, sort?: SortState | SortState[]) //** 基本表
*/
selectCells(cellRanges: CellRange[]): void
```
其中:
{{ use: CellRange() }}

## getSelectedCellInfos(Function)

Expand All @@ -178,6 +180,9 @@ setRecords(records: Array<any>, sort?: SortState | SortState[]) //** 基本表
/**获取选中区域的每个单元格详情 */
getSelectedCellInfos(): CellInfo[][] | null;
```

{{ use: CellInfo() }}

## clearSelected(Function)

清除所有单元格的选中状态。
Expand Down Expand Up @@ -709,6 +714,19 @@ use case: 点击图例项后 更新过滤规则 来更新图表
changeCellValue: (col: number, row: number, value: string | number | null) => void;
```

## changeCellValues(Function)
批量更改单元格的value:

```
/**
* 批量更新多个单元格的数据
* @param col 粘贴数据的起始列号
* @param row 粘贴数据的起始行号
* @param values 多个单元格的数据数组
*/
changeCellValues(startCol: number, startRow: number, values: string[][])
```

## getEditor(Function)

获取单元格配置的编辑器
Expand Down
103 changes: 103 additions & 0 deletions docs/assets/demo/en/interaction/copy-paste-cell-value.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
category: examples
group: Interaction
title: Copy and paste cell value
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/copy-paste-cell-value.gif
link: '../guide/interaction/keyboard'
option: ListTable#keyboardOptions.pasteValueToCell
---

# Copy and paste cell value

Use shortcut keys to copy the contents of the selected cell and paste the contents of the clipboard into the cell.

Of course, in addition to the arrow keys, there are other shortcut keys, please refer to [Tutorial](../../guide/interaction/keyboard).

## Key Configurations

- keyboardOptions.pasteValueToCell
- keyboardOptions.copySelected

## Code demo

```javascript livedemo template=vtable

let tableInstance;
fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/North_American_Superstore_data.json')
.then((res) => res.json())
.then((data) => {

const columns =[
{
"field": "Order ID",
"title": "Order ID",
"width": "auto"
},
{
"field": "Customer ID",
"title": "Customer ID",
"width": "auto"
},
{
"field": "Product Name",
"title": "Product Name",
"width": "auto"
},
{
"field": "Category",
"title": "Category",
"width": "auto"
},
{
"field": "Sub-Category",
"title": "Sub-Category",
"width": "auto"
},
{
"field": "Region",
"title": "Region",
"width": "auto"
},
{
"field": "City",
"title": "City",
"width": "auto"
},
{
"field": "Order Date",
"title": "Order Date",
"width": "auto"
},
{
"field": "Quantity",
"title": "Quantity",
"width": "auto"
},
{
"field": "Sales",
"title": "Sales",
"width": "auto"
},
{
"field": "Profit",
"title": "Profit",
"width": "auto"
}
];

const option = {
records:data,
columns,
widthMode:'standard',
frozenColCount:1,
overscrollBehavior:'none',
keyboardOptions:{
moveEditCellOnArrowKeys:true,
copySelected: true,
pasteValueToCell: true
}
};
tableInstance = new VTable.ListTable(document.getElementById(CONTAINER_ID),option);
window['tableInstance'] = tableInstance;
})
```
7 changes: 7 additions & 0 deletions docs/assets/demo/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,13 @@
"zh": "方向键切换选中单元格",
"en": "arrowkeys move select"
}
},
{
"path": "copy-paste-cell-value",
"title": {
"zh": "复制粘贴",
"en": "copy paste cell value"
}
}
]
},
Expand Down
103 changes: 103 additions & 0 deletions docs/assets/demo/zh/interaction/copy-paste-cell-value.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
category: examples
group: Interaction
title: 复制粘贴
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/copy-paste-cell-value.gif
link: '../guide/interaction/keyboard'
option: ListTable#keyboardOptions.pasteValueToCell
---

# 复制粘贴单元格内容

使用快捷键复制选中单元格内容,粘贴剪切板中内容到单元格。

当然,除了方向键还有其他快捷键可以参考[教程](../../guide/interaction/keyboard)

## 关键配置

- keyboardOptions.pasteValueToCell
- keyboardOptions.copySelected

## 代码演示

```javascript livedemo template=vtable

let tableInstance;
fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/North_American_Superstore_data.json')
.then((res) => res.json())
.then((data) => {

const columns =[
{
"field": "Order ID",
"title": "Order ID",
"width": "auto"
},
{
"field": "Customer ID",
"title": "Customer ID",
"width": "auto"
},
{
"field": "Product Name",
"title": "Product Name",
"width": "auto"
},
{
"field": "Category",
"title": "Category",
"width": "auto"
},
{
"field": "Sub-Category",
"title": "Sub-Category",
"width": "auto"
},
{
"field": "Region",
"title": "Region",
"width": "auto"
},
{
"field": "City",
"title": "City",
"width": "auto"
},
{
"field": "Order Date",
"title": "Order Date",
"width": "auto"
},
{
"field": "Quantity",
"title": "Quantity",
"width": "auto"
},
{
"field": "Sales",
"title": "Sales",
"width": "auto"
},
{
"field": "Profit",
"title": "Profit",
"width": "auto"
}
];

const option = {
records:data,
columns,
widthMode:'standard',
frozenColCount:1,
overscrollBehavior:'none',
keyboardOptions:{
moveEditCellOnArrowKeys:true,
copySelected: true,
pasteValueToCell: true
}
};
tableInstance = new VTable.ListTable(document.getElementById(CONTAINER_ID),option);
window['tableInstance'] = tableInstance;
})
```
2 changes: 1 addition & 1 deletion docs/assets/guide/en/data/data_format.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ Table data can be deleted using `deleteRecords`. Please check the api documentat
### change the data
There is currently no dedicated interface for modifying data, but it can be achieved by combining the interfaces for deleting and adding data. First call `deleteRecords` and then `addRecords`.

Or you can modify a certain data field using the `changeCellValue` interface.
Or you can modify a certain data field using the `changeCellValue` or `changeCellValues` interface.

## summarize

Expand Down
8 changes: 8 additions & 0 deletions docs/assets/guide/en/edit/edit_cell.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,14 @@ Editing trigger timing support: double-click a cell to enter editing, click a ce
/** Set the value of the cell. Note that it corresponds to the original value of the source data, and the vtable instance records will be modified accordingly */
changeCellValue: (col: number, row: number, value: string | number | null) => void;

/**
* Batch update data of multiple cells
* @param col The starting column number of pasted data
* @param row The starting row number of pasted data
* @param values Data array of multiple cells
*/
changeCellValues(startCol: number, startRow: number, values: string[][])

/** Get the editor of cell configuration */
getEditor: (col: number, row: number) => IEditor;

Expand Down
3 changes: 3 additions & 0 deletions docs/assets/guide/en/interaction/keyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ In order to facilitate users to operate the form, we provide the following short
|top|Same as above|
|bottom|Same as above|
|ctrl+c|The key position is incorrect. This copy is consistent with the browser's shortcut key. <br> To copy the contents of selected cells, you need to enable keyboardOptions.copySelected|
|ctrl+v|The key position is not correct, the paste shortcut key is the same as the browser shortcut key. <br> To paste content into a cell, you need to enable keyboardOptions.pasteValueToCell|
|ctrl+a|Select all, you need to enable keyboardOptions.selectAllOnCtrlA|
|shift|Hold shift and the left mouse button to select cells in a continuous area|
|ctrl|Hold down ctrl and the left mouse button to select multiple areas|
Expand All @@ -32,5 +33,7 @@ keyboardOptions: {
selectAllOnCtrlA?: boolean;
/** Shortcut key copy, default false, not enabled*/
copySelected?: boolean; //This copy is consistent with the browser’s shortcut keys
/** Shortcut key to paste. Paste content to the specified location (that is, it needs to be selected). Batch paste is supported. Default: false */
pasteValueToCell?: boolean;
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ This configuration is the simplest configuration for multidimensional tables. As
## Data analysis related configuration:
|Configuration item|Type|Description|
|:----|:----|:----|
|rows|string[] \| IDimension[]|Row dimension field array, used to parse out the corresponding dimension members|
|columns|string[] \| IDimension[]|Column dimension field array, used to parse out the corresponding dimension members|
|indicators|string[] \| IIndicator[]|Specific display indicators|
|rows|(IRowDimension \| string)[]|Row dimension field array, used to parse out the corresponding dimension members|
|columns|(IColumnDimension \| string)[]|Column dimension field array, used to parse out the corresponding dimension members|
|indicators|(IIndicator \| string)[]|Specific display indicators|
|dataConfig.aggregationRules|aggregationRule[]|Aggregation value calculation rules according to row and column dimensions|
|dataConfig.derivedFieldRules|DerivedFieldRule[]|Derived fields|
|dataConfig.sortRules|sortRule[]|Sort rules|
Expand Down
Loading

0 comments on commit ebb7fa3

Please sign in to comment.