Skip to content

Commit 4c40128

Browse files
Leopoldthecoderziyoung
authored andcommitted
Table: fix params on docs (#11774)
* Table: fix params on docs * Table: add missing definitions * Table: fix row style definitions * Update table.d.ts
1 parent 3319846 commit 4c40128

File tree

4 files changed

+38
-8
lines changed

4 files changed

+38
-8
lines changed

examples/docs/en-US/table.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,8 +1963,8 @@ You can customize row index in `type=index` columns.
19631963
| cell-style | function that returns custom style for a cell, or an object assigning custom style for every cell | Function({row, column, rowIndex, columnIndex})/Object |||
19641964
| header-row-class-name | function that returns custom class names for a row in table header, or a string assigning class names for every row in table header | Function({row, rowIndex})/String |||
19651965
| header-row-style | function that returns custom style for a row in table header, or an object assigning custom style for every row in table header | Function({row, rowIndex})/Object |||
1966-
| header-cell-class-name | function that returns custom class names for a cell in table header, or a string assigning class names for every cell in table header | Function({row, rowIndex})/String |||
1967-
| header-cell-style | function that returns custom style for a cell in table header, or an object assigning custom style for every cell in table header | Function({row, rowIndex})/Object |||
1966+
| header-cell-class-name | function that returns custom class names for a cell in table header, or a string assigning class names for every cell in table header | Function({row, column, rowIndex, columnIndex})/String |||
1967+
| header-cell-style | function that returns custom style for a cell in table header, or an object assigning custom style for every cell in table header | Function({row, column, rowIndex, columnIndex})/Object |||
19681968
| row-key | key of row data, used for optimizing rendering. Required if `reserve-selection` is on. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used. | Function(row)/String |||
19691969
| empty-text | Displayed text when data is empty. You can customize this area with `slot="empty"` | String || No Data |
19701970
| default-expand-all | whether expand all rows by default, only works when the table has a column type="expand" | Boolean || false |

examples/docs/es/table.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,8 +1966,8 @@ Puede personalizar el índice de la fila con la propiedad `type=index` de las co
19661966
| cell-style | función que devuelve estilos personalizados para una celda, o un objeto asignado a estilos personalizados para cada celda | Function({row, column, rowIndex, columnIndex})/Object |||
19671967
| header-row-class-name | función que devuelve nombre de clases personalizadas para una fila en la cabecera de la tabla, o una cadena asignando nombres de clases para cada fila en la cabecera de la tabla | Function({row, rowIndex})/String |||
19681968
| header-row-style | función que devuelve estilos personalizados para una fila en la cabecera de la tabla, o un objeto asignando estilos personalizados para cada fila en la cabecera de la tabla | Function({row, rowIndex})/Object |||
1969-
| header-cell-class-name | función que devuelve nombre de clases personalizadas para una celda en la cabecera de la tabla, o una cadena asignando nombres de clases para cada celda en la cabecera de la tabla | Function({row, rowIndex})/String |||
1970-
| header-cell-style | función que devuelve estilos personalizados para una celda en la cabecera de la tabla, o un objeto asignando estilos personalizados para cada celda en la cabecera de la tabla | Function({row, rowIndex})/Object |||
1969+
| header-cell-class-name | función que devuelve nombre de clases personalizadas para una celda en la cabecera de la tabla, o una cadena asignando nombres de clases para cada celda en la cabecera de la tabla | Function({row, column, rowIndex, columnIndex})/String |||
1970+
| header-cell-style | función que devuelve estilos personalizados para una celda en la cabecera de la tabla, o un objeto asignando estilos personalizados para cada celda en la cabecera de la tabla | Function({row, column, rowIndex, columnIndex})/Object |||
19711971
| row-key | clave de datos de la fila, utilizada para optimizar la representación de los datos. Es obligatorio `reserve-selection` esta habilitado. Cuando su tipo es string, se permite el acceso multinivel, por ejemplo, `user.info.id`, pero `user.info[0].id` no es permitido, en cuyo caso se debe usar una `function` | Function(row)/String |||
19721972
| empty-text | Texto mostrado cuando no existen datos. Puede personalizar esta área con `slot="empty"` | String || No Data |
19731973
| default-expand-all | especifica si todas las filas se expanden por defeto, solo funciona cuando la tabla tiene una columna `type="expand"` | Boolean || false |

examples/docs/zh-CN/table.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,7 @@
20242024
| header-row-class-name | 表头行的 className 的回调方法,也可以使用字符串为所有表头行设置一个固定的 className。 | Function({row, rowIndex})/String |||
20252025
| header-row-style | 表头行的 style 的回调方法,也可以使用一个固定的 Object 为所有表头行设置一样的 Style。 | Function({row, rowIndex})/Object |||
20262026
| header-cell-class-name | 表头单元格的 className 的回调方法,也可以使用字符串为所有表头单元格设置一个固定的 className。 | Function({row, column, rowIndex, columnIndex})/String |||
2027-
| header-cell-style | 表头单元格的 style 的回调方法,也可以使用一个固定的 Object 为所有表头单元格设置一样的 Style。 | Function({row, rowIndex, rowIndex, columnIndex})/Object |||
2027+
| header-cell-style | 表头单元格的 style 的回调方法,也可以使用一个固定的 Object 为所有表头单元格设置一样的 Style。 | Function({row, column, rowIndex, columnIndex})/Object |||
20282028
| row-key | 行数据的 Key,用来优化 Table 的渲染;在使用 reserve-selection 功能的情况下,该属性是必填的。类型为 String 时,支持多层访问:`user.info.id`,但不支持 `user.info[0].id`,此种情况请使用 `Function`| Function(row)/String |||
20292029
| empty-text | 空数据时显示的文本内容,也可以通过 `slot="empty"` 设置 | String || 暂无数据 |
20302030
| default-expand-all | 是否默认展开所有行,当 Table 中存在 type="expand" 的 Column 的时候有效 | Boolean || false |

types/table.d.ts

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ export interface SummaryMethodParams {
1717
data: object
1818
}
1919

20+
export interface rowCallbackParams {
21+
row: object,
22+
rowIndex: number
23+
}
24+
25+
export interface cellCallbackParams {
26+
row: object,
27+
rowIndex: number,
28+
column: object,
29+
columnIndex: number
30+
}
31+
2032
/** Table Component */
2133
export declare class ElTable extends ElementUIComponent {
2234
/** Table data */
@@ -47,10 +59,28 @@ export declare class ElTable extends ElementUIComponent {
4759
currentRowKey: string | number
4860

4961
/** Function that returns custom class names for a row, or a string assigning class names for every row */
50-
rowClassName: string | ((row: object, index: number) => string)
62+
rowClassName: string | ((param: rowCallbackParams) => string)
63+
64+
/** Function that returns custom style for a row, or an object assigning custom style for every row */
65+
rowStyle: object | ((param: rowCallbackParams) => object)
66+
67+
/** Function that returns custom class names for a cell, or a string assigning class names for every cell */
68+
cellClassName: string | ((param: cellCallbackParams) => string)
69+
70+
/** Function that returns custom style for a cell, or an object assigning custom style for every cell */
71+
cellStyle: object | ((param: cellCallbackParams) => object)
72+
73+
/** Function that returns custom class names for a row in table header, or a string assigning class names for every row in table header */
74+
headerRowClassName: string | ((param: rowCallbackParams) => string)
75+
76+
/** Function that returns custom style for a row in table header, or an object assigning custom style for every row in table header */
77+
headerRowStyle: object | ((param: rowCallbackParams) => object)
78+
79+
/** Function that returns custom class names for a cell in table header, or a string assigning class names for every cell in table header */
80+
headerCellClassName: string | ((param: cellCallbackParams) => string)
5181

52-
/** Function that returns custom style for a row, or a string assigning custom style for every row */
53-
rowStyle: string | object | ((row: object, index: number) => object)
82+
/** Function that returns custom style for a cell in table header, or an object assigning custom style for every cell in table header */
83+
headerCellStyle: object | ((param: cellCallbackParams) => object)
5484

5585
/** Key of row data, used for optimizing rendering. Required if reserve-selection is on */
5686
rowKey: (row: object) => any

0 commit comments

Comments
 (0)