-
Notifications
You must be signed in to change notification settings - Fork 572
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: columnResizable #1106
base: master
Are you sure you want to change the base?
feat: columnResizable #1106
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
02c41ed
to
0eab6c4
Compare
README.md
Outdated
@@ -132,6 +133,7 @@ React.render(<Table columns={columns} data={data} />, mountNode); | |||
| fixed | String \| Boolean | | this column will be fixed when table scroll horizontally: true or 'left' or 'right' | | |||
| align | String | | specify how cell content is aligned | | |||
| ellipsis | Boolean | | specify whether cell content be ellipsized | | |||
| resizable | Boolean \| { minWidth?: number } | | column resize config | |
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.
如果是这样子的话,我感觉 columnResizable
这个属性都不需要了。column.resizable
控制粒度更小,反而更好。另外 minWidth
不用放 resizable
里,直接是 column.minWidth
就够了。这个属性平时用也是很不错的。
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.
这样的话,每列都要加一遍,虽然可以 map 加过去,但是还是太麻烦。这个 minWidth 在 resizable 没开启时是什么行为?(现在 antd Table 没设置横向滚动时,父容器缩小,列也会跟着缩小)
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.
columnResizable 已移除。如果改成 column.minWidth,比如没开启 scroll 时,浏览器宽度缩小,列宽度都会自动缩小的,这个没办法。
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.
没开启 resizable 时,这个 minWidth 感觉没用。
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.
columnResizable 已移除。如果改成 column.minWidth,比如没开启 scroll 时,浏览器宽度缩小,列宽度都会自动缩小的,这个没办法。
这个 OK 的,能添加 minWidth 就行了。再多的就是游览器的限制了
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.
那这个 column.minWidth 其实就只是在 resizable 开启时有用了,其它时候就算写了也是没用的,minWidth 只支持 number 类型吧?
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.
有用的,如果多个设置 minWidth,剩余的不设置。设置的最小宽度就定下了
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.
没看懂。minWidth 应该是可以先在这个之前单独一个版本加这个功能,先跟 resizable 无关。
问题:那这时 minWidth 根本没有场景啊,都没有 resizable 的功能。比如浏览器 resize 导致 Table 缩小了宽度,列的宽度自动会被缩小,没办法限制,这个 minWidth 应该设置了也没用?
体验有点怪异,如果是超出 width 的时候缩小应该就是缩小,不应该把右边的撑开才对。 |
6ad31d3
to
c50f2da
Compare
c50f2da
to
97d5903
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1106 +/- ##
==========================================
+ Coverage 97.97% 98.06% +0.09%
==========================================
Files 51 53 +2
Lines 4681 4913 +232
Branches 595 627 +32
==========================================
+ Hits 4586 4818 +232
Misses 91 91
Partials 4 4 ☔ View full report in Codecov by Sentry. |
rfc: ant-design/ant-design#48152
原先内部
onColumnResize
重命名为onColumnWidthChange
,进行区分