-
-
Notifications
You must be signed in to change notification settings - Fork 614
feat: support rowspan expanded #1276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
crazyair
wants to merge
19
commits into
react-component:master
from
crazyair:support-row-span-expanded
Closed
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
45a6c49
feat: support rowspan-expanded
crazyair b80b72a
feat: review
crazyair 8565bfa
feat: review
crazyair 532e524
feat: review
crazyair 239af54
feat: review
crazyair b5fc268
feat: review
crazyair 094972a
feat: review
crazyair 2f15e97
feat: rowKeys
crazyair 5f41e75
feat: 不改虚拟表格
crazyair 668ef08
feat: review
crazyair ff959d9
feat: review
crazyair 92106b5
feat: review
crazyair c3a21ff
feat: review
crazyair 0b53334
chore: move keys to cache
zombieJ d91920e
chore: simplify code
zombieJ dd7d053
chore: clean up
zombieJ 2ed330a
chore: adjust offset
zombieJ e606eed
feat: 回退 offset 功能
crazyair 1cb0013
feat: 去掉 rowSpan > 1 判断,只要 rowSpan = 1 则 +1,如果 rowSpan = undefined 则不 +1
crazyair File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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: expandedRowSpan | ||
nav: | ||
title: Demo | ||
path: /demo | ||
--- | ||
|
||
<code src="../examples/expandedRowSpan.tsx"></code> |
This file contains hidden or 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,55 @@ | ||
import React from 'react'; | ||
import Table from 'rc-table'; | ||
import '../../assets/index.less'; | ||
import type { ColumnsType } from '@/interface'; | ||
|
||
const columns: ColumnsType = [ | ||
{ | ||
title: '手机号', | ||
dataIndex: 'a', | ||
colSpan: 2, | ||
width: 100, | ||
onCell: (_, index) => { | ||
const props: React.TdHTMLAttributes<HTMLTableCellElement> = {}; | ||
if (index === 1) { | ||
props.rowSpan = 4; | ||
} else if (index === 2) { | ||
props.rowSpan = 0; | ||
} else if (index === 3) { | ||
props.rowSpan = 0; | ||
} else if (index === 4) { | ||
props.rowSpan = 0; | ||
} | ||
|
||
return props; | ||
}, | ||
}, | ||
{ title: '电话', dataIndex: 'b', colSpan: 0, width: 100 }, | ||
Table.EXPAND_COLUMN, | ||
{ title: 'Name', dataIndex: 'c', width: 100 }, | ||
{ title: 'Address', dataIndex: 'd', width: 200 }, | ||
]; | ||
|
||
const data = [ | ||
{ a: '12313132132', b: '0571-43243256', c: '小二', d: '文零西路', e: 'Male', key: 'z' }, | ||
{ a: '13812340987', b: '0571-12345678', c: '张三', d: '文一西路', e: 'Male', key: 'a' }, | ||
{ a: '13812340987', b: '0571-12345678', c: '张夫人', d: '文一西路', e: 'Female', key: 'b' }, | ||
{ a: '13812340987', b: '0571-099877', c: '李四', d: '文二西路', e: 'Male', key: 'c' }, | ||
{ a: '13812340987', b: '0571-099877', c: '李四', d: '文二西路', e: 'Male', key: 'd' }, | ||
{ a: '1381200008888', b: '0571-099877', c: '王五', d: '文二西路', e: 'Male', key: 'e' }, | ||
]; | ||
|
||
const Demo = () => ( | ||
<div> | ||
<h2>expanded & rowSpan</h2> | ||
<Table<Record<string, any>> | ||
rowKey="key" | ||
columns={columns} | ||
data={data} | ||
expandable={{ expandedRowRender: record => <p style={{ margin: 0 }}>{record.key}</p> }} | ||
className="table" | ||
/> | ||
</div> | ||
); | ||
|
||
export default Demo; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.