-
-
Notifications
You must be signed in to change notification settings - Fork 591
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Column add hidden * test: add test * docs: add demo * docs: add hidden * docs: update demo
- Loading branch information
Showing
9 changed files
with
238 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: column-hidden | ||
nav: | ||
title: Demo | ||
path: /demo | ||
--- | ||
|
||
<code src="../examples/column-hidden.tsx"></code> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: grouping-columns-hidden | ||
nav: | ||
title: Demo | ||
path: /demo | ||
--- | ||
|
||
<code src="../examples/grouping-columns-hidden.tsx"></code> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { TableProps } from 'rc-table'; | ||
import Table from 'rc-table'; | ||
import React from 'react'; | ||
import '../../assets/index.less'; | ||
|
||
interface RecordType { | ||
a?: string; | ||
b?: string; | ||
c?: string; | ||
} | ||
|
||
const data = [ | ||
{ a: '123', key: '1' }, | ||
{ a: 'cdd', b: '2', key: '2' }, | ||
{ a: '1333', c: 'eee', d: 2, key: '3' }, | ||
]; | ||
|
||
const Demo = () => { | ||
const columns: TableProps<any>['columns'] = [ | ||
{ | ||
title: 'title1', | ||
dataIndex: 'a', | ||
}, | ||
{ | ||
title: 'title12', | ||
dataIndex: 'b', | ||
hidden: true, | ||
}, | ||
{ | ||
title: 'title13', | ||
dataIndex: 'c', | ||
}, | ||
]; | ||
|
||
return <Table<RecordType> columns={columns} data={data} />; | ||
}; | ||
|
||
export default Demo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import React from 'react'; | ||
import Table from 'rc-table'; | ||
import '../../assets/index.less'; | ||
|
||
const columns = [ | ||
{ | ||
title: '姓名', | ||
dataIndex: 'name', | ||
key: 'name', | ||
}, | ||
{ | ||
title: '其它', | ||
children: [ | ||
{ | ||
title: '年龄', | ||
dataIndex: 'age', | ||
key: 'age', | ||
}, | ||
{ | ||
title: '住址', | ||
children: [ | ||
{ | ||
title: '街道', | ||
dataIndex: 'street', | ||
key: 'street', | ||
hidden: true, | ||
}, | ||
{ | ||
title: '小区', | ||
children: [ | ||
{ | ||
title: '单元', | ||
dataIndex: 'building', | ||
key: 'building', | ||
}, | ||
{ | ||
title: '门牌', | ||
dataIndex: 'number', | ||
key: 'number', | ||
hidden: true, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
title: '公司', | ||
children: [ | ||
{ | ||
title: '地址', | ||
dataIndex: 'companyAddress', | ||
key: 'companyAddress', | ||
hidden: true, | ||
}, | ||
{ | ||
title: '名称', | ||
dataIndex: 'companyName', | ||
key: 'companyName', | ||
}, | ||
], | ||
}, | ||
{ | ||
title: '性别', | ||
dataIndex: 'gender', | ||
key: 'gender', | ||
}, | ||
]; | ||
|
||
const data = [ | ||
{ | ||
key: '1', | ||
name: '胡彦斌', | ||
age: 32, | ||
street: '拱墅区和睦街道', | ||
building: 1, | ||
number: 2033, | ||
companyAddress: '西湖区湖底公园', | ||
companyName: '湖底有限公司', | ||
gender: '男', | ||
}, | ||
{ | ||
key: '2', | ||
name: '胡彦祖', | ||
age: 42, | ||
street: '拱墅区和睦街道', | ||
building: 3, | ||
number: 2035, | ||
companyAddress: '西湖区湖底公园', | ||
companyName: '湖底有限公司', | ||
gender: '男', | ||
}, | ||
]; | ||
|
||
const Demo = () => ( | ||
<div> | ||
<h2>grouping columns hidden</h2> | ||
<Table columns={columns} data={data} className="bordered" /> | ||
</div> | ||
); | ||
|
||
export default Demo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
941fd0a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
table – ./
table-react-component.vercel.app
table-git-master-react-component.vercel.app