Skip to content

Commit

Permalink
docs: 优化 spreadsheet class api 文档 (#2969)
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 authored Nov 8, 2024
1 parent c837efe commit 12be6b5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
10 changes: 7 additions & 3 deletions s2-site/docs/api/basic-class/spreadsheet.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ s2.isPivotMode()

| 参数 | 说明 | 类型 | 版本 |
| --- |------------------------------------------------------------------------------------------------------------------------| --- |----|
| dom | 挂载的容器节点 | `string` \| `HTMLElement` | |
| themeName | 主题名 | [ThemeName](/api/general/s2-theme#themename) | |
| theme | 主题配置 | [S2Theme](/docs/api/general/S2Theme) | |
| store | 存储的一些信息 | [Store](/docs/api/basic-class/store) | |
| dataCfg | 数据配置 | [S2DataConfig](/docs/api/general/S2DataConfig) | |
Expand All @@ -24,11 +24,15 @@ s2.isPivotMode()
| tooltip | 提示信息 | [BaseTooltip](/docs/api/basic-class/base-tooltip) | |
| container | g-canvas 实例 | [Canvas](https://g.antv.antgroup.com/api/renderer/canvas) | |
| interaction | 交互 | [Interaction](/zh/docs/api/basic-class/interaction) | |
| hd | 开启高清适配 | [HdAdapter](https://github.com/antvis/S2/blob/next/packages/s2-core/src/ui/hd-adapter/index.ts) | |
| hdAdapter | 高清适配器 | [HdAdapter](https://github.com/antvis/S2/blob/next/packages/s2-core/src/ui/hd-adapter/index.ts) | |
| destroyed | 表格是否已销毁 | `boolean` | |
| on | 事件订阅 | (event: [S2Event](/docs/manual/advanced/interaction/basic), listener: () => void) => void | |
| emit | 事件发布 | (event: [S2Event](/docs/manual/advanced/interaction/basic), ...args: any[]) => void | |
| getDataSet | 获取数据集 | (options: [S2Options](/docs/api/general/S2Options)) => [BaseDataSet](/docs/api/basic-class/base-data-set) | |
| isPivotMode | 是否是透视表 | `() => boolean` | |
| isCustomRowFields | 是否是自定义行头维值 | `() => boolean` | |
| isCustomColumnFields | 是否是自定义列头维值 | `() => boolean` | |
| isCustomHeaderFields | 是否是自定义表头维值 | `() => boolean` | |
| isHierarchyTreeType | 是否是树状结构 | `() => boolean` | |
| isFrozenRowHeader | 是否是冻结行头状态 | `() => boolean` | |
| isTableMode | 是否是明细表 | `() => boolean` | |
Expand All @@ -48,7 +52,7 @@ s2.isPivotMode()
| setThemeCfg | 更新主题配置 (含主题 schema, 色板,主题名) | (themeCfg: [ThemeCfg](/docs/api/general/S2Theme/#themecfg)) => void | |
| setTheme | 更新主题 (只包含主题 scheme) | (theme: [S2Theme](/docs/api/general/S2Theme/#s2theme)) => void | |
| getTheme | 获取主题 (只包含主题 scheme) | ( ) => [S2Theme](/docs/api/general/S2Theme/#s2theme) | |
| getThemeName | 获取主题名 | ( ) => `default \| colorful \| gray \| dark` | |
| getThemeName | 获取主题名 | () => [ThemeName](/api/general/s2-theme#themename) | |
| updatePagination | 更新分页 | (pagination: [Pagination](/docs/api/general/S2Options#pagination)) => void | |
| changeSheetSize | 修改表格画布大小,不用重新加载数据 | `(width?: number, height?: number) => void` | |
| getLayoutWidthType | 获取单元格宽度布局类型(LayoutWidthType: `adaptive(自适应)` \| `colAdaptive(列自适应)` \| `compact(紧凑)`| () => `LayoutWidthType`| |
Expand Down
19 changes: 15 additions & 4 deletions s2-site/docs/api/general/S2Theme.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,28 @@ s2.setTheme({

功能描述:表格主题配置项。查看 [文档](/manual/basic/theme)[示例](/examples/theme/default/#colorful)

| 参数 | 参数 | 类型 | 默认值 | 必选 |
| 参数 | 说明 | 类型 | 默认值 | 必选 |
| ------- | ----------- | --------------------------------- | --------- | ---- |
| theme | 主题 schema | [S2Theme](#s2theme) | - | |
| palette | 色板 | [Palette](#palette) | - | |
| name | 主题名 | `default` \| `colorful` \| `gray` | `default` | |
| name | 主题名 | [ThemeName](#themename) | `default` | |

### ThemeName

功能描述:表格主题名称。查看 [文档](/manual/basic/theme)[示例](/examples/theme/default/#colorful)

| 参数 | 说明 | 类型 | 默认值 | 必选 |
| ---- | -------------- | ---------------------- | ------ | ---- |
| default | 默认 | `string` | - | |
| colorful | 多彩蓝 | `string` | - | |
| gray | 简约灰 | `string` | - | |
| dark | 暗黑 | `string` | - | |

### Palette

功能描述:表主题色板。查看 [文档](/manual/basic/theme)[示例](/examples/theme/custom/#custom-palette)

| 参数 | 参数 | 类型 | 默认值 | 必选 |
| 参数 | 说明 | 类型 | 默认值 | 必选 |
| ------------------- | --------------------------------------------------- | ---------------------------------------------------------------- | ------ | ---- |
| brandColor | 色板主题色 | `string` | - ||
| basicColors | 基础颜色 | `string[]` | - ||
Expand All @@ -50,7 +61,7 @@ s2.setTheme({

功能描述:表格主题 `Schema`. 查看 [文档](/manual/basic/theme#%E4%B8%BB%E9%A2%98-schema)[示例](/examples/theme/custom/#custom-palette)

| 参数 | 参数 | 类型 | 默认值 | 必选 |
| 参数 | 说明 | 类型 | 默认值 | 必选 |
| ----------------- | -------------------------------------- | ----------------------------------------------- | ------ | ---- |
| cornerCell | 角头单元格主题 | [DefaultCellTheme](#defaultcelltheme) | | |
| rowCell | 行头单元格主题 | [DefaultCellTheme](#defaultcelltheme) | | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ fetch(
displayCondition: (meta) => meta.level > 0,
onClick: (options) => {
console.log(options);
const { meta, event } = options;

meta.spreadsheet.handleGroupSort(event, meta);
},
onHover: (options) => {
console.log(options);
},
},
{
Expand All @@ -38,7 +38,7 @@ fetch(
onClick: (options) => {
const { meta, event } = options;

meta.spreadsheet.tooltip.show({
meta.spreadsheet.showTooltip({
position: { x: event.clientX, y: event.clientY },
content: `<div>ColTooltip</div>`,
});
Expand All @@ -51,7 +51,7 @@ fetch(
onClick: (options) => {
const { meta, event } = options;

meta.spreadsheet.tooltip.show({
meta.spreadsheet.showTooltip({
position: { x: event.clientX, y: event.clientY },
content: `<div>CornerTooltip</div>`,
});
Expand All @@ -66,7 +66,7 @@ fetch(
onClick: (options) => {
const { meta, event } = options;

meta.spreadsheet.tooltip.show({
meta.spreadsheet.showTooltip({
position: { x: event.clientX, y: event.clientY },
content: `<div>RowTooltip</div>`,
});
Expand All @@ -83,7 +83,7 @@ fetch(

content.innerHTML = '我是 RowTooltip 自定义内容';

meta.spreadsheet.tooltip.show({
meta.spreadsheet.showTooltip({
position: { x: event.clientX, y: event.clientY },
content,
});
Expand Down

0 comments on commit 12be6b5

Please sign in to comment.