Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Auto release] release 0.13.1 #481

Merged
merged 14 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
519 changes: 173 additions & 346 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

67 changes: 67 additions & 0 deletions docs/assets/api/en/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,68 @@ Getting the style of a cell
*/
getCellStyle(col: number, row: number) => CellStyle
```
## getRecordByCell(Function)

Get the data item of this cell

```
/**
* Get the entire data record based on the row and column number
* @param {number} col col index.
* @param {number} row row index.
* @return {object} record.
*/
getRecordByCell(col: number, row: number)
```
## getTableIndexByRecordIndex(Function)
Get the index row number or column number displayed in the table based on the index of the data source (related to transposition). Note: ListTable specific interface

```
/**
* Get the index row number or column number displayed in the table based on the index of the data source (related to transposition). Note: ListTable specific interface
* @param recordIndex
*/
getTableIndexByRecordIndex: (recordIndex: number) => number;
```

## 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). Note: ListTable specific interface
```
/**
* Get the index row number or column number displayed in the table according to the field of the data source (related to transposition). Note: ListTable specific interface
* @param recordIndex
*/
getTableIndexByField: (field: FieldDef) => number;
```
## getCellAddrByFieldRecord(Function)

Get the cell row and column number based on the index and field in the data source. Note: ListTable specific interface
```
/**
* Get the cell row and column number based on the index and field in the data source. Note: ListTable specific interface
* @param field
* @param recordIndex
* @returns
*/
getCellAddrByFieldRecord: (field: FieldDef, recordIndex: number) => CellAddress;
```
## getCellOriginRecord(Function)

Get the source data item of this cell.

If it is a normal table, the source data object will be returned.

If it is a pivot analysis table (a pivot table with data analysis turned on), an array of source data will be returned.

```
/**
* Get source data based on row and column numbers
* @param {number} col col index.
* @param {number} row row index.
* @return {object} record or record array
*/
getCellOriginRecord(col: number, row: number)
```

## getAllCells(Function)

Expand Down Expand Up @@ -270,6 +332,11 @@ For pivot table interfaces, get specific cell addresses based on the header dime
| IDimensionInfo[]
) => CellAddress
```
## getCheckboxState(Function)
Get the selected status of all data in the checkbox under a certain field. The order corresponds to the original incoming data records. It does not correspond to the status value of the row displayed in the table.
```
getCheckboxState(field: string | number): Array
```

## scrollToCell(Function)

Expand Down
68 changes: 68 additions & 0 deletions docs/assets/api/zh/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,69 @@ tableInstance.renderWithRecreateCells();
*/
getCellStyle(col: number, row: number) => CellStyle
```
## getRecordByCell(Function)

获取该单元格的数据项

```
/**
* 根据行列号获取整条数据记录
* @param {number} col col index.
* @param {number} row row index.
* @return {object} record.
*/
getRecordByCell(col: number, row: number)
```

## getTableIndexByRecordIndex(Function)
根据数据源的index 获取显示到表格中的index 行号或者列号(与转置相关)。注:ListTable特有接口

```
/**
* 根据数据源的index 获取显示到表格中的index 行号或者列号(与转置相关)。注:ListTable特有接口
* @param recordIndex
*/
getTableIndexByRecordIndex: (recordIndex: number) => number;
```

## getTableIndexByField(Function)
根据数据源的field 获取显示到表格中的index 行号或者列号(与转置相关)。注:ListTable特有接口
```
/**
* 根据数据源的field 获取显示到表格中的index 行号或者列号(与转置相关)。注:ListTable特有接口
* @param recordIndex
*/
getTableIndexByField: (field: FieldDef) => number;
```
## getCellAddrByFieldRecord(Function)

根据数据源中的index和field获取单元格行列号。注:ListTable特有接口
```
/**
* 根据数据源中的index和field获取单元格行列号。注:ListTable特有接口
* @param field
* @param recordIndex
* @returns
*/
getCellAddrByFieldRecord: (field: FieldDef, recordIndex: number) => CellAddress;
```
## getCellOriginRecord(Function)

获取该单元格的源数据项。

如果是普通表格,会返回源数据的对象。

如果是透视分析表(开启了数据分析的透视表),会返回源数据的数组。

```
/**
* 根据行列号获取源数据
* @param {number} col col index.
* @param {number} row row index.
* @return {object} record or record array
*/
getCellOriginRecord(col: number, row: number)
```
## getAllCells(Function)

获取所有单元格上下文信息
Expand Down Expand Up @@ -269,6 +331,12 @@ tableInstance.renderWithRecreateCells();
)=> CellAddress
```

## getCheckboxState(Function)
获取某个字段下checkbox 全部数据的选中状态 顺序对应原始传入数据records 不是对应表格展示row的状态值
```
getCheckboxState(field: string | number): Array
```

## scrollToCell(Function)

滚动到具体某个单元格位置。
Expand Down
33 changes: 20 additions & 13 deletions docs/assets/demo/en/cell-type/checkbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
category: examples
group: Cell Type
title: Checkbox Type
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/checkbox.png
order: 2-2
cover: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VTable/preview/checkbox-demo.png
link: '../guide/cell_type/checkbox'
option: ListTable-columns-checkbox#cellType
---

# Data Bar Type
# Checbox Type

Demonstrate multiple ways to use checkbox

Expand All @@ -20,23 +20,30 @@ cellType: 'checkbox';
```javascript livedemo template=vtable

const records = [
{ percent: '100%', value: 20, check: { text: 'unchecked', checked: false, disable: false } },
{ percent: '80%', value: 18, check: { text: 'checked', checked: true, disable: false } },
{ percent: '60%', value: 16, check: { text: 'disable', checked: true, disable: true } },
{ percent: '40%', value: 14, check: { text: 'disable', checked: false, disable: true } },
{ percent: '20%', value: 12, check: { text: 'checked', checked: false, disable: false } },
{ percent: '0%', value: 10, check: { text: 'checked', checked: false, disable: false } },
{ percent: '0%', value: -10, check: { text: 'checked', checked: false, disable: false } }
{ productName: 'aaaa', price: 20, check: { text: 'unchecked', checked: false, disable: false } },
{ productName: 'bbbb', price: 18, check: { text: 'checked', checked: true, disable: false } },
{ productName: 'cccc', price: 16, check: { text: 'disable', checked: true, disable: true } },
{ productName: 'cccc', price: 14, check: { text: 'disable', checked: false, disable: true } },
{ productName: 'eeee', price: 12, check: { text: 'checked', checked: false, disable: false } },
{ productName: 'ffff', price: 10, check: { text: 'checked', checked: false, disable: false } },
{ productName: 'gggg', price: 10, check: { text: 'checked', checked: false, disable: false } }
];

const columns = [
{
field: '',
title: '',
width: 60,
headerType: 'checkbox',
cellType: 'checkbox',
},
{
field: 'percent',
title: 'percent',
field: 'productName',
title: 'productName',
width: 120
},
{
field: 'percent',
field: 'price',
title: 'checkbox',
width: 120,
cellType: 'checkbox',
Expand Down
6 changes: 3 additions & 3 deletions docs/assets/demo/en/component/legend.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ In this example, the background color of the cell is mapped by the category Dime
bodyStyle: {
bgColor(args) {
const { row, col } = args;
const record = args.table.getRecordByRowCol(col, row);
const record = args.table.getRecordByCell(col, row);
return colorToCategory[categorys.indexOf(record.Category)];
}
}
Expand Down Expand Up @@ -146,15 +146,15 @@ In this example, the background color of the cell is mapped by the category Dime
bodyStyle: {
color(args) {
const { row, col } = args;
const record = tableInstance.getRecordByRowCol(col, row);
const record = tableInstance.getRecordByCell(col, row);
if (highlightCategorys.indexOf(record.Category) >= 0) {
return 'black';
}
return '#e5dada';
},
bgColor(args) {
const { row, col } = args;
const record = tableInstance.getRecordByRowCol(col, row);
const record = tableInstance.getRecordByCell(col, row);
if (highlightCategorys.indexOf(record.Category) >= 0) {
return colorToCategory[categorys.indexOf(record.Category)];
}
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/demo/en/custom-render/custom-cell-layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ VTable.register.icon('message',{
},
customLayout: (args) => {
const { table,row,col,rect } = args;
const record = table.getRecordByRowCol(col,row);
const record = table.getRecordByCell(col,row);
const {height, width } = rect ?? table.getCellRect(col,row);
const percentCalc = VTable.CustomLayout.percentCalc;

Expand Down
2 changes: 1 addition & 1 deletion docs/assets/demo/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
{
"path": "checkbox",
"title": {
"zh": "选择框类型",
"zh": "复选框类型",
"en": "Checkbox Type"
},
"meta": {
Expand Down
Loading