Skip to content
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

feat: 💥 support tableLayout and column.ellipsis #17284

Merged
merged 11 commits into from Sep 5, 2019
Merged

Conversation

afc163
Copy link
Member

@afc163 afc163 commented Jun 25, 2019

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

react-component/table#369

close #13825 (comment)
close #17127
close #5753

💡 Background and solution

  1. <Table tableLayout="fixed" />
  2. column.ellipsis

image

const columns = [{
   title: 'Long Column Long Column Long Column',
   dataIndex: 'address',
   key: 'address 2',
+  ellipsis: true,
}]

📝 Changelog

Language Changelog
🇺🇸 English - Table supports tableLayout property for table-layout attribute. And using tableLayout="fixed" defaully in scrollable table situation to resolve align issue caused by cell content.
- Table supports column.ellipsis to ellipsize cell content.
🇨🇳 Chinese - Table 新增 tableLayout 属性,支持设置表格的 table-layout 布局,并在固定表头/列下默认开启 tableLayout="fixed",解决因为表格自动根据内容排版造成的列对齐问题。
- Table 新增 column.ellipsis 支持单元格内容自动省略。

☑️ Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

IssueHunt Summary

Referenced issues

This pull request has been submitted to:


IssueHunt has been backed by the following sponsors. Become a sponsor

@pr-triage pr-triage bot added the PR: draft label Jun 25, 2019
Copy link

@tests-checker tests-checker bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add tests to make sure this change works as expected?

@netlify
Copy link

netlify bot commented Jun 25, 2019

Deploy preview for ant-design ready!

Built with commit 4fe4706

https://deploy-preview-17284--ant-design.netlify.com

@netlify
Copy link

netlify bot commented Sep 3, 2019

Deploy preview for ant-design ready!

Built with commit 0ad9967

https://deploy-preview-17284--ant-design.netlify.com

@zombieJ
Copy link
Member

zombieJ commented Sep 3, 2019

放 4.0 里?

@afc163
Copy link
Member Author

afc163 commented Sep 3, 2019

这个加 3.x 里能解决表格当前很多对齐问题。

@afc163 afc163 changed the title Feat table layout feat: support tableLayout="fixed" and column.ellipsis Sep 3, 2019
@buildsize
Copy link

buildsize bot commented Sep 3, 2019

File name Previous Size New Size Change
package-lock.json 848.29 KB 849.97 KB 1.69 KB (0%)

@afc163 afc163 changed the title feat: support tableLayout="fixed" and column.ellipsis feat: support tableLayout and column.ellipsis Sep 3, 2019
@codecov
Copy link

codecov bot commented Sep 3, 2019

Codecov Report

Merging #17284 into feature will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           feature   #17284      +/-   ##
===========================================
+ Coverage    96.74%   96.78%   +0.03%     
===========================================
  Files          280      280              
  Lines         7552     7552              
  Branches      2104     2093      -11     
===========================================
+ Hits          7306     7309       +3     
+ Misses         244      241       -3     
  Partials         2        2
Impacted Files Coverage Δ
components/table/Table.tsx 95.39% <100%> (ø) ⬆️
components/_util/wave.tsx 88.46% <0%> (+2.88%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 18e57e9...0ad9967. Read the comment docs.

@afc163
Copy link
Member Author

afc163 commented Sep 4, 2019

Dynamic Settings 例子里可以加上 ellipsis 和 fixed 的设置

已加

@afc163
Copy link
Member Author

afc163 commented Sep 4, 2019

用例都挂了,https://github.com/kaimallea/isMobile/ 最近没发版本,见鬼了。

image

@afc163
Copy link
Member Author

afc163 commented Sep 4, 2019

原来是我把这个发掉了:react-component/menu@72242cf

@zombieJ
Copy link
Member

zombieJ commented Sep 4, 2019

👍 看着 OK 了,CI fix 了就可以合了。

@afc163 afc163 merged commit 2e59284 into feature Sep 5, 2019
@afc163 afc163 deleted the feat-table-layout branch September 5, 2019 05:39
@@ -328,6 +333,7 @@
&-thead > tr > th,
&-tbody > tr > td {
padding: @table-padding-vertical @table-padding-horizontal;
overflow-wrap: break-word;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还需要给设定了宽度的列加上,word-break: break-word 不然还是会有对齐问题。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

来了 #18789

@jeessy2
Copy link

jeessy2 commented Oct 16, 2019

省略能自动加title不呢?不然列表里面看不清到底是啥内容

@fengyun2
Copy link

表头能否也加上这个属性呢?

@Airkro
Copy link
Contributor

Airkro commented Oct 17, 2019

在上一版本中 columns.width 设为 1 可以达到 min-content 的效果。但现在不管用了

我认为 tableLayout='auto' 可以解决,但该属性没有生效。

@afc163
Copy link
Member Author

afc163 commented Oct 17, 2019

表头能否也加上这个属性呢?

@fengyun2 之前试过不太好加,可以来试试给个 PR

@Jkanon
Copy link

Jkanon commented Oct 18, 2019

我加上这个属性之后,表头单元格也省略了,我感觉得表头标题不应该省略,应该加个属性切换

@HoikanChan
Copy link

antd已经上了这个功能了
https://ant.design/components/table-cn/#components-table-demo-ellipsis
麻烦加上该功能

@wuzhonghao1
Copy link

table中的columns.ellipsis属性与table的scroll属性在火狐上不兼容,出现不对齐且无法实现省略号的问题

@arange arange mentioned this pull request Jul 15, 2021
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants