Added selectionColumnWidth to TableRowSelection (#9474)

* Added selectionColumnWidth to TableRowSelection

* Updated documents

* Renamed selectionColumnWidth to columnWidth
This commit is contained in:
SimpleFrontend 2018-03-05 11:23:01 +01:00 committed by 偏右
parent 5e7bff8b5e
commit 9073237e70
4 changed files with 4 additions and 0 deletions

View File

@ -641,6 +641,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
render: this.renderSelectionBox(rowSelection.type),
className: selectionColumnClass,
fixed: rowSelection.fixed,
width: rowSelection.columnWidth,
};
if (rowSelection.type !== 'radio') {
const checkboxAllDisabled = data.every((item, index) => this.getCheckboxPropsByItem(item, index).disabled);

View File

@ -155,6 +155,7 @@ Properties for row selection.
| getCheckboxProps | Get Checkbox or Radio props | Function(record) | - |
| hideDefaultSelections | Remove the default `Select All` and `Select Invert` selections | boolean | `false` |
| selectedRowKeys | Controlled selected row keys | string\[] | \[] |
| columnWidth | Set the width of the selection column | string\|number | - |
| selections | Custom selection [config](#rowSelection), only displays default selections when set to `true` | object\[]\|boolean | - |
| type | `checkbox` or `radio` | `checkbox` \| `radio` | `checkbox` |
| onChange | Callback executed when selected rows change | Function(selectedRowKeys, selectedRows) | - |

View File

@ -156,6 +156,7 @@ const columns = [{
| getCheckboxProps | 选择框的默认属性配置 | Function(record) | - |
| hideDefaultSelections | 去掉『全选』『反选』两个默认选项 | boolean | false |
| selectedRowKeys | 指定选中项的 key 数组,需要和 onChange 进行配合 | string\[] | \[] |
| columnWidth | 自定义列表选择框宽度 | string\|number | - |
| selections | 自定义选择项 [配置项](#selection), 设为 `true` 时使用默认选择项 | object\[]\|boolean | true |
| type | 多选/单选,`checkbox` or `radio` | string | `checkbox` |
| onChange | 选中项发生变化的时的回调 | Function(selectedRowKeys, selectedRows) | - |

View File

@ -73,6 +73,7 @@ export interface TableRowSelection<T> {
selections?: SelectionItem[] | boolean;
hideDefaultSelections?: boolean;
fixed?: boolean;
columnWidth?: string | number;
}
export interface TableProps<T> {