From 306bce385bca4487ad5c2aec9b55c31511f6f810 Mon Sep 17 00:00:00 2001 From: Wei Zhu Date: Tue, 25 Sep 2018 19:47:34 +0800 Subject: [PATCH] Improve type definition and doc of TableComponents --- components/table/createBodyRow.tsx | 2 +- components/table/index.en-US.md | 2 +- components/table/index.zh-CN.md | 2 +- components/table/interface.tsx | 14 +++++++------- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/components/table/createBodyRow.tsx b/components/table/createBodyRow.tsx index f73bc8ca8a..41297df838 100644 --- a/components/table/createBodyRow.tsx +++ b/components/table/createBodyRow.tsx @@ -16,7 +16,7 @@ interface BodyRowState { export interface BodyRowClass extends React.ComponentClass {} -export default function createTableRow(Component = 'tr') { +export default function createTableRow(Component: React.ReactType = 'tr') { class BodyRow extends React.Component { private store: Store; private unsubscribe: () => void; diff --git a/components/table/index.en-US.md b/components/table/index.en-US.md index d6a58eaf2b..22dd568c09 100644 --- a/components/table/index.en-US.md +++ b/components/table/index.en-US.md @@ -55,7 +55,7 @@ const columns = [{ | bordered | Whether to show all table borders | boolean | `false` | | childrenColumnName | The column contains children to display | string\[] | children | | columns | Columns of table | [ColumnProps](https://git.io/vMMXC)\[] | - | -| components | Override default table elements | object | - | +| components | Override default table elements | [TableComponents](https://git.io/fANxz) | - | | dataSource | Data record array to be displayed | any\[] | - | | defaultExpandAllRows | Expand all rows initially | boolean | `false` | | defaultExpandedRowKeys | Initial expanded row keys | string\[] | - | diff --git a/components/table/index.zh-CN.md b/components/table/index.zh-CN.md index 816d84100a..032495d54c 100644 --- a/components/table/index.zh-CN.md +++ b/components/table/index.zh-CN.md @@ -60,7 +60,7 @@ const columns = [{ | bordered | 是否展示外边框和列边框 | boolean | false | | childrenColumnName | 指定树形结构的列名 | string\[] | children | | columns | 表格列的配置描述,具体项见下表 | [ColumnProps](https://git.io/vMMXC)\[] | - | -| components | 覆盖默认的 table 元素 | object | - | +| components | 覆盖默认的 table 元素 | [TableComponents](https://git.io/fANxz) | - | | dataSource | 数据数组 | any\[] | | | defaultExpandAllRows | 初始时,是否展开所有行 | boolean | false | | defaultExpandedRowKeys | 默认展开的行 | string\[] | - | diff --git a/components/table/interface.tsx b/components/table/interface.tsx index 8786176841..63bab9be1c 100644 --- a/components/table/interface.tsx +++ b/components/table/interface.tsx @@ -37,16 +37,16 @@ export interface ColumnProps { } export interface TableComponents { - table?: any; + table?: React.ReactType; header?: { - wrapper?: any; - row?: any; - cell?: any; + wrapper?: React.ReactType; + row?: React.ReactType; + cell?: React.ReactType; }; body?: { - wrapper?: any; - row?: any; - cell?: any; + wrapper?: React.ReactType; + row?: React.ReactType; + cell?: React.ReactType; }; }