From 265a3db5ed2e9e7a0fda7e8e86744ceb50920e12 Mon Sep 17 00:00:00 2001 From: Oneday Date: Tue, 17 Oct 2017 10:02:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E6=A1=86=E5=88=97=E7=9A=84=E5=BC=80=E5=85=B3=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=20#13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ src/index.tsx | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bec0b21..45cbe04 100644 --- a/README.md +++ b/README.md @@ -330,6 +330,10 @@ Pixels to offset from top when calculating position of scroll Pixels to offset from bottom when calculating position of scroll +### `showSelectColumns?`: boolean + +show select columns or not, default is true + ## FAQ ### How to trigger the `onSearch` action imperatively? diff --git a/src/index.tsx b/src/index.tsx index 339ea60..0f4c11a 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -106,6 +106,8 @@ export interface IDataTableProps { /** reject handler */ onError? (err): void, rowSelection?: TableRowSelection, + /** 是否展示选择框列 */ + showSelectColumns?: boolean, affixTarget?: () => HTMLElement, affixOffsetTop?: number, affixOffsetBottom?: number @@ -173,7 +175,8 @@ export class DataTable extends React.Component pageSize: 10, searchBtnText: 'Search', clearBtnText: 'Clear', - listSelectionBtnText: 'List selection' + listSelectionBtnText: 'List selection', + showSelectColumns: true } readonly actionsColumn = this.props.rowActions && { key: 'actions', title: 'Actions', render: (record) => { return renderActions(this.props.rowActions as RowAction[], record) } } as TableColumnConfig @@ -349,14 +352,14 @@ export class DataTable extends React.Component } render () { - const rowSelection = Object.assign({}, { + const rowSelection = this.props.showSelectColumns ? Object.assign({}, { selectedRowKeys: this.state.selectedRowKeys, onChange: (selectedRowKeys, selectedRows) => { this.setState({ selectedRowKeys, selectedRows }) } - }, this.props.rowSelection) + }, this.props.rowSelection) : undefined const ActionPanel = this.props.plugins && ( From 439a1cf3c1f92f58fec4456e020399cba9c0197f Mon Sep 17 00:00:00 2001 From: Oneday Date: Tue, 17 Oct 2017 12:59:52 +0800 Subject: [PATCH 2/2] feat: action text #16 --- README.md | 4 ++++ src/index.tsx | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 45cbe04..c93ea9d 100644 --- a/README.md +++ b/README.md @@ -334,6 +334,10 @@ Pixels to offset from bottom when calculating position of scroll show select columns or not, default is true +### `actionText:` string + +action header title, default is 'Action' + ## FAQ ### How to trigger the `onSearch` action imperatively? diff --git a/src/index.tsx b/src/index.tsx index 0f4c11a..897ba7c 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -93,6 +93,7 @@ export interface IDataTableProps { title?: React.ReactNode, searchBtnText?: string, clearBtnText?: string, + actionText?: string, listSelectionBtnText?: string, /** 最大的表单项显示数,当表单项超过此数值时,会自动出现 collapse 按钮 */ maxVisibleFieldCount?: number, @@ -176,10 +177,11 @@ export class DataTable extends React.Component searchBtnText: 'Search', clearBtnText: 'Clear', listSelectionBtnText: 'List selection', - showSelectColumns: true + showSelectColumns: true, + actionText: 'Action' } - readonly actionsColumn = this.props.rowActions && { key: 'actions', title: 'Actions', render: (record) => { return renderActions(this.props.rowActions as RowAction[], record) } } as TableColumnConfig + readonly actionsColumn = this.props.rowActions && { key: 'actions', title: this.props.actionText, render: (record) => { return renderActions(this.props.rowActions as RowAction[], record) } } as TableColumnConfig readonly shouldShowTableTitle = this.props.title || this.props.enableListSelection