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

docs: 优化文档说法和校正有误的内容 #1640

Merged
merged 4 commits into from
Aug 3, 2022
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
5 changes: 5 additions & 0 deletions packages/s2-react/playground/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,11 @@ function MainLayout() {
exportCfg: { open: true },
advancedSortCfg: { open: true },
}}
getSpreadSheet={(s2) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
window.s2 = s2;
}}
onDataCellTrendIconClick={logHandler('onDataCellTrendIconClick')}
onAfterRender={logHandler('onAfterRender')}
onDestroy={logHandler('onDestroy')}
Expand Down
82 changes: 41 additions & 41 deletions s2-site/docs/api/basic-class/interaction.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,48 @@ order: 2
s2.interaction.xx()
```

| 参数 | 说明 | 类型 |
| --- | --- | --- |
| spreadsheet | 表格实例 | [SpreadSheet](/zh/docs/api/basic-class/spreadsheet) |
| interactions | 当前已注册的交互 | `Map<string, BaseEvent>` |
| intercept | 当前拦截的交互,防止不同交互之间冲突 | `Set<Intercept>` |
| destroy | 卸载所有交互实例,并重置为初始状态 | `() => void` |
| reset | 重置所有交互 | `() => void` |
| setState | 设置状态 | (data: [InteractionStateInfo](#interactionstateinfo)) => void |
| getState | 获取当前状态 | `() => void` |
| resetState | 重置为初始状态 | `() => void` |
| clearState | 清空状态,并重绘 | `() => void` |
| changeState | 更新状态 | (data: [InteractionStateInfo](#interactionstateinfo)) => void |
| setInteractedCells | 设置当前发生改变的单元格 | (cell: [S2CellType](#s2celltype)) => void |
| getInteractedCells | 获取当前发生改变的单元格 | () => [S2CellType](#s2celltype)[] |
| getCurrentStateName | 获取当前状态名 | `() => void` |
| isEqualStateName | 是否是相同的状态名 | `(name: InteractionStateName) => void` |
| isSelectedState | 是否是选中状态 | `() => void` |
| isHoverState | 是否是悬停状态 | `() => void` |
| isHoverFocusState | 是否是悬停聚焦状态 (悬停在单元格 `focusTime`: 默认 800ms 后) | `() => void` |
| isSelectedCell | 是否是选中的单元格 | (cell: [S2CellType](#s2celltype)) => void |
| isActiveCell | 是否是激活的单元格 | (cell: [S2CellType](#s2celltype)) => void |
| getCells | 获取当前 interaction 记录的 Cells 元信息列表,包括不在视口内的格子 | `() => Partial<ViewMeta>[]` |
| getActiveCells | 获取当前在可视区域的单元格实例 | `() => S2CellType[]` |
| clearStyleIndependent | 清除单元格样式 | `() => void` |
| getPanelGroupAllUnSelectedDataCells | 获取可视区域内选中的数值单元格 | `() => DataCell[]` |
| getPanelGroupAllDataCells | 获取可视区域内的所有数值单元格 | `() => DataCell[]` |
| getAllRowHeaderCells | 获取行头单元格 | `() => RowCell[]` |
| getAllColHeaderCells | 获取列头单元格 | `() => ColCell[]` |
| getRowColActiveCells | 获取行头和列头激活的单元格 | `() => RowCell[] | ColCell[]` |
| getAllCells | 获取所有单元格 | () => [S2CellType](#s2celltype)[] |
| selectAll | 选中所有单元格 | `() => void` |
| selectHeaderCell | 选中指定行列头单元格 | (selectHeaderCellInfo: [SelectHeaderCellInfo](#selectheadercellinfo)) => boolean |
| getCellChildrenNodes | 获取当前单元格的所以子节点 | (cell: [S2CellType](#s2celltype)) => [Node]((/zh/docs/api/basic-class/node))[] |
| 参数 | 说明 | 类型 |
| --- |--------------------------------------------------| --- |
| spreadsheet | 表格实例 | [SpreadSheet](/zh/docs/api/basic-class/spreadsheet) |
| interactions | 当前已注册的交互 | `Map<string, BaseEvent>` |
| intercept | 当前拦截的交互,防止不同交互之间冲突 | `Set<Intercept>` |
| destroy | 卸载所有交互实例,并重置为初始状态 | `() => void` |
| reset | 重置所有交互 | `() => void` |
| setState | 设置状态 | (data: [InteractionStateInfo](#interactionstateinfo)) => void |
| getState | 获取当前状态 | `() => void` |
| resetState | 重置为初始状态 | `() => void` |
| clearState | 清空状态,并重绘 | `() => void` |
| changeState | 更新状态 | (data: [InteractionStateInfo](#interactionstateinfo)) => void |
| setInteractedCells | 设置当前发生改变的单元格 | (cell: [S2CellType](#s2celltype)) => void |
| getInteractedCells | 获取当前发生改变的单元格 | () => [S2CellType](#s2celltype)[] |
| getCurrentStateName | 获取当前状态名 | `() => void` |
| isEqualStateName | 是否是相同的状态名 | `(name: InteractionStateName) => void` |
| isSelectedState | 是否是选中状态 | `() => void` |
| isHoverState | 是否是悬停状态 | `() => void` |
| isHoverFocusState | 是否是悬停聚焦状态 (悬停在单元格 `focusTime`: 默认 800ms 后) | `() => void` |
| isSelectedCell | 是否是选中的单元格 | (cell: [S2CellType](#s2celltype)) => void |
| isActiveCell | 是否是激活的单元格 | (cell: [S2CellType](#s2celltype)) => void |
| getCells | 获取当前 interaction 记录的 Cells 元信息列表,包括不在视口内的格子 | `() => Partial<ViewMeta>[]` |
| getActiveCells | 获取当前在可视区域的单元格实例 | `() => S2CellType[]` |
| clearStyleIndependent | 清除单元格样式 | `() => void` |
| getPanelGroupAllUnSelectedDataCells | 获取可视区域内选中的数值单元格 | `() => DataCell[]` |
| getPanelGroupAllDataCells | 获取可视区域内的所有数值单元格 | `() => DataCell[]` |
| getAllRowHeaderCells | 获取行头单元格 | `() => RowCell[]` |
| getAllColHeaderCells | 获取列头单元格 | `() => ColCell[]` |
| getRowColActiveCells | 获取行头和列头激活的单元格 | `() => RowCell[] | ColCell[]` |
| getAllCells | 获取所有可视区域内的单元格 | () => [S2CellType](#s2celltype)[] |
| selectAll | 选中所有单元格 | `() => void` |
| selectHeaderCell | 选中指定行列头单元格 | (selectHeaderCellInfo: [SelectHeaderCellInfo](#selectheadercellinfo)) => boolean |
| getCellChildrenNodes | 获取当前单元格的所以子节点 | (cell: [S2CellType](#s2celltype)) => [Node]((/zh/docs/api/basic-class/node))[] |
| hideColumns | 隐藏列 (forceRender 为 `false` 时,隐藏列为空的情况下,不再触发表格更新) | `(hiddenColumnFields: string[], forceRender?: boolean = true) => void` |
| mergeCells | 合并单元格 | (cellsInfo?: [MergedCellInfo](#mergedcellinfo)[], hideData?: boolean) => void |
| unmergeCells | 取消合并单元格 | `(removedCells: MergedCell[]) => void` |
| updatePanelGroupAllDataCells | 更新所有数值单元格 | `() => void` |
| updateCells | 更新指定单元格 | (cells: [S2CellType](#s2celltype)[]) => void |
| addIntercepts | 新增交互拦截 | (interceptTypes: [InterceptType](#intercepttype)[]) => void |
| hasIntercepts | 是否有指定拦截的交互 | (interceptTypes: [InterceptType](#intercepttype)[]) => boolean |
| removeIntercepts | 移除指定交互拦截 | (interceptTypes: [InterceptType](#intercepttype)[]) => void |
| highlightNodes | 高亮节点对应的单元格 | (nodes: [Node](/zh/docs/api/basic-class/node)[]) => void |
| mergeCells | 合并单元格 | (cellsInfo?: [MergedCellInfo](#mergedcellinfo)[], hideData?: boolean) => void |
| unmergeCells | 取消合并单元格 | `(removedCells: MergedCell[]) => void` |
| updatePanelGroupAllDataCells | 更新所有数值单元格 | `() => void` |
| updateCells | 更新指定单元格 | (cells: [S2CellType](#s2celltype)[]) => void |
| addIntercepts | 新增交互拦截 | (interceptTypes: [InterceptType](#intercepttype)[]) => void |
| hasIntercepts | 是否有指定拦截的交互 | (interceptTypes: [InterceptType](#intercepttype)[]) => boolean |
| removeIntercepts | 移除指定交互拦截 | (interceptTypes: [InterceptType](#intercepttype)[]) => void |
| highlightNodes | 高亮节点对应的单元格 | (nodes: [Node](/zh/docs/api/basic-class/node)[]) => void |

`markdown:docs/common/interaction.zh.md`

Expand Down
6 changes: 1 addition & 5 deletions s2-site/docs/api/general/S2Options.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,4 @@ DataSet = (spreadsheet: SpreadSheet) => BaseDataSet;

## MergedCellInfo

| 参数 | 说明 | 类型 | 默认值 | 必选 |
| --------------- | ------------------ | ---------------------- | ------ | ---- |
| colIndex | 单元格的列索引 | `number` | - | |
| rowIndex | 单元格的行索引 | `number` | - | |
| showText | 合并单元格是否展示当前单元格的 meta 信息,只需要对一个单元格进行标识,</br>若未对单元格进行标识,会默认使用第一个选中点击的单元格的 meta 信息 | `booelan` | - | |
`markdown:docs/common/merged-cell.zh.md`
5 changes: 5 additions & 0 deletions s2-site/docs/common/merged-cell.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Merge-Cell
order: 10
---
`markdown:docs/common/merge-cell.zh.md`
14 changes: 14 additions & 0 deletions s2-site/docs/common/merged-cell.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: 合并单元
order: 10
---

<description> **optional** _MergedCellInfo[][]_ default: `undefined` </description>

设置默认合并的单元格信息

| 参数 | 说明 | 类型 | 默认值 | 必选 |
| --------------- |--------------------------------------------------------------------------------| ---------------------- | ------ | ---- |
| colIndex | 单元格的列索引 | `number` | - | |
| rowIndex | 单元格的行索引 | `number` | - | |
| showText | 设置 `showText: true` 时,则展示当前格子的 `meta` 信息为合并后单元格的 `meta`。<br/> 默认使用第一个选中点击的单元格。 | `booelan` | - | |
12 changes: 3 additions & 9 deletions s2-site/docs/manual/advanced/interaction/merge-cell.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,17 +343,11 @@ s2.render();

## 配置和方法说明

### mergedCellsInfo
### MergedCellInfo

<description> **optional** _MergedCellInfo[][]_ default: `undefined` </description>
`markdown:docs/common/merged-cell.zh.md`

设置默认合并的单元格信息

| 参数 | 说明 | 类型 | 默认值 | 必选 |
| --------------- | ------------------ | ---------------------- | ------ | ---- |
| colIndex | 单元格的列索引 | `number` | - | |
| rowIndex | 单元格的行索引 | `number` | - | |
| showText | 合并单元格是否展示当前单元格的 meta 信息,只需要对一个单元格进行标识,</br>若未对单元格进行标识,会默认使用第一个选中点击的单元格的 meta 信息 | `booelan` | - | |
![合并单元格](https://gw.alipayobjects.com/zos/antfincdn/kHAYfFaJA/ae92e636-6574-487b-8d78-57dcae21e1d4.png)

### mergeCells

Expand Down
2 changes: 1 addition & 1 deletion s2-site/docs/manual/basic/sort/basic.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ order: 0

根据 `数值升/降序` 对 `行头/列头` 进行排序

`组内排序` 代表只影响一个分组内部的排序,例如下图中 `笔-价格` 选择 `组内升序` 时,`province` 的排序方式不会更改,只会更改每个 `province` 内部 `city` 的顺序
`组内排序` 代表只影响一个分组内部的排序,例如下图中 `笔-价格` 选择 `组内升序` 时,`省份` 的排序方式不会更改,只会更改每个 `省份` 内部 `城市` 的顺序

<img src="https://gw.alipayobjects.com/mdn/rms_56cbb2/afts/img/A*SszqS7EGaXkAAAAAAAAAAAAAARQnAQ" width = "600" alt="row" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ fetch('../data/index-comparison.json')
},
{
field: 'price',
name: '金额',
name: '销售量',
},
{
field: 'uv',
Expand Down
8 changes: 4 additions & 4 deletions s2-site/examples/data/index-comparison.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"tag": "本周成交情况",
"type": "女装",
"price": "200"
"price": "500"
},
{
"tag": "本周成交情况",
Expand All @@ -22,7 +22,7 @@
{
"tag": "本周成交情况",
"type": "男装",
"price": "300"
"price": "200"
},
{
"tag": "本周成交情况",
Expand Down Expand Up @@ -62,7 +62,7 @@
{
"tag": "本周成交情况",
"type": "男/女鞋",
"price": "600"
"price": "60"
},
{
"tag": "本周成交情况",
Expand All @@ -82,7 +82,7 @@
{
"tag": "本周成交情况",
"type": "箱包配饰",
"price": "3000"
"price": "1000"
},
{
"tag": "本周成交情况",
Expand Down