From aed86044b8c86559a1508596c862763490763f5c Mon Sep 17 00:00:00 2001 From: zrj1031 Date: Wed, 15 Jul 2020 11:44:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Table=20=E9=BB=98=E8=AE=A4=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E6=95=B0=E6=8D=AE=E9=A1=B9=E5=8F=AF=E6=8C=89column?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E5=B1=95=E7=A4=BA=EF=BC=8C=E4=B8=8D=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E5=9C=A8=E5=BA=95=E9=83=A8=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/docs/zh-CN/table.md | 2 ++ source/components/Table/ColumnFiltrateModal.tsx | 4 ++-- source/components/Table/interface.tsx | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/site/docs/zh-CN/table.md b/site/docs/zh-CN/table.md index 3452db3b6..651035da5 100644 --- a/site/docs/zh-CN/table.md +++ b/site/docs/zh-CN/table.md @@ -115,6 +115,7 @@ const columns = [{ title: 'Address', dataIndex: 'address', key: 'address', + filtrateDefault: true, }, { title: 'Action', key: 'action', @@ -2264,6 +2265,7 @@ ReactDOM.render(,mountNode); | filtrateTitle | 筛选Checkbox显示文字 | String \| ReactNode | - | | width | 列宽度 | String \| Number | - | | ellipsis | 该列是否使用ellipsis属性,需要配合`scroll.x`使用,且指定列宽度,固定列中使用需要指定为像素宽度。 | Boolean | false | +| filtrateDefault | 默认展示数据项,且按column位置展示,不统一在底部展示,区别columnFiltrate.defaultColumns | Boolean | false | ### ColumnGroup diff --git a/source/components/Table/ColumnFiltrateModal.tsx b/source/components/Table/ColumnFiltrateModal.tsx index 6a463f638..42e5d168b 100644 --- a/source/components/Table/ColumnFiltrateModal.tsx +++ b/source/components/Table/ColumnFiltrateModal.tsx @@ -122,7 +122,7 @@ class ColumnFiltrateModal extends React.Component, Col this.setState({ checkedOption, okButtonDisabled: ( - JSON.stringify(checkedOption && checkedOption.sort()) == + JSON.stringify(checkedOption && checkedOption.sort()) == JSON.stringify(checkedOptionConfirm && checkedOptionConfirm.sort()) ) }); @@ -137,7 +137,7 @@ class ColumnFiltrateModal extends React.Component, Col .map((column) => { const uniqKey = getColumnKey(column); //fixed /分组不能控制显示隐藏 - const disabled = !!column.fixed || !!column.children; + const disabled = !!column.fixed || !!column.children || !!column.filtrateDefault; const title = column.filtrateTitle || column.title; return { label: {title}, diff --git a/source/components/Table/interface.tsx b/source/components/Table/interface.tsx index 64e9b19ad..76c75d645 100755 --- a/source/components/Table/interface.tsx +++ b/source/components/Table/interface.tsx @@ -38,6 +38,7 @@ export interface ColumnProps { onCell?: (record: T) => any; onHeaderCell?: (props: ColumnProps) => any; ellipsis?: boolean; + filtrateDefault?: boolean; } export interface TableComponents {