feat: customCell add column arg, close #5052

pull/5057/head
tangjinzhou 2021-12-17 21:23:56 +08:00
parent 79ea8918e5
commit 443640effa
4 changed files with 4 additions and 3 deletions

View File

@ -179,7 +179,7 @@ One of the Table `columns` prop for describing the table's columns, Column has t
| maxWidth | Drag the maximum width of the column, it will be affected by the automatic adjustment and distribution of the table width | number | - | 3.0 |
| resizable | Whether the width can be adjusted by dragging, at this time width must be number type | boolean | - | 3.0 |
| width | Width of this column | string\|number | - | |
| customCell | Set props on per cell | Function(record, rowIndex) | - | |
| customCell | Set props on per cell | Function(record, rowIndex, column) | - | column add from 3.0 |
| customHeaderCell | Set props on per header cell | Function(column) | - | |
| onFilter | Callback executed when the confirm filter button is clicked, Use as a `filter` event when using template or jsx | Function | - | |
| onFilterDropdownVisibleChange | Callback executed when `filterDropdownVisible` is changed, Use as a `filterDropdownVisible` event when using template or jsx | function(visible) {} | - | |

View File

@ -185,7 +185,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/f-SbcX2Lx/Table.svg
| minWidth | 拖动列最小宽度,会受到表格自动调整分配宽度影响 | number | 50 | 3.0 |
| maxWidth | 拖动列最大宽度,会受到表格自动调整分配宽度影响 | number | - | 3.0 |
| resizable | 是否可拖动调整宽度,此时 width 必须是 number 类型 | boolean | - | 3.0 |
| customCell | 设置单元格属性 | Function(record, rowIndex) | - | |
| customCell | 设置单元格属性 | Function(record, rowIndex, column) | - | column add from 3.0 |
| customHeaderCell | 设置头部单元格属性 | Function(column) | - | |
| onFilter | 本地模式下,确定筛选的运行函数, 使用 template 或 jsx 时作为`filter`事件使用 | Function | - | |
| onFilterDropdownVisibleChange | 自定义筛选菜单可见变化时调用,使用 template 或 jsx 时作为`filterDropdownVisibleChange`事件使用 | function(visible) {} | - | |

View File

@ -145,7 +145,7 @@ export default defineComponent<BodyRowProps<unknown>>({
let additionalCellProps;
if (column.customCell) {
additionalCellProps = column.customCell(record, index);
additionalCellProps = column.customCell(record, index, column);
}
return (

View File

@ -136,6 +136,7 @@ export interface StickyOffsets {
export type GetComponentProps<DataType> = (
data: DataType,
index?: number,
column?: ColumnType<any>,
) => Omit<HTMLAttributes, 'style'> & { style?: CSSProperties };
type Component<P> = DefineComponent<P> | FunctionalComponent<P> | string;