-
Notifications
You must be signed in to change notification settings - Fork 290
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
Row z-index and a column resizer double click callback #189
Conversation
Allows drag handle to naturally sit over row below.
Rows reusal causes order to not matter.
-Setting style is hard to override so use classes. -Remove wrapper that was preventing whole row z-index to be set based on selected row.
Use dist folder so we don't have to build internal.
Also, use better antialiasing method.
I had previously removed the row wrapper.
@KamranAsif could you take a look at this since you have the most extensive knowledge of issues related to row z-indexing? Also if you have some time I'd appreciate a primer on what we've dealt with in the past there. |
dist/fixed-data-table-base.css
Outdated
@@ -17,6 +17,107 @@ | |||
* LICENSE file in the root directory of this source tree. An additional grant | |||
* of patent rights can be found in the PATENTS file in the same directory. | |||
* |
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.
Can you revert all the changes to dist & main.js?
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.
Yes
site/base.less
Outdated
@@ -6,7 +6,7 @@ html, body { | |||
-ms-text-size-adjust: 100%; | |||
margin: 0; | |||
padding: 0; | |||
-webkit-font-smoothing: antialiased; | |||
-webkit-font-smoothing: subpixel-antialiased; |
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.
what was your motivation here? could you revert unless there's a good driver?
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.
I will revert
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.
BTW, I was looking at this some more and I kind of think this should just be removed all together: http://usabilitypost.com/2012/11/05/stop-fixing-font-smoothing/
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.
I think it's worth filing an issue for it, but I don't think it relates to your changeset and alters the styling of the docs so I'd rather not block merge on time to research it.
If I'm missing something and it's related to the changeset though, let me know.
src/FixedDataTableRow.js
Outdated
@@ -106,6 +106,11 @@ class FixedDataTableRowImpl extends React.Component { | |||
* @param number distance | |||
*/ | |||
onColumnReorderEnd: PropTypes.func, | |||
|
|||
/** | |||
* Whether the row has a bottom borer accross it |
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.
nit border spelling
FixedDataTableTranslateDOMPosition(style, 0, this.props.offsetTop, this._initialRender); | ||
|
||
return ( | ||
<div |
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.
I'm not sure it's safe to remove this wrapping div. Could you add it back and we can revisit removing in a minor release.
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.
Ok. I think I had a better reason but can't remember any more. I will put it back and see if my changes still work.
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.
+1 please revert
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.
Below, I noted that "the reason I removed the wrapping div is that the class needs to be added on the outer most div or it won't reorder the z-index of the row."
src/FixedDataTable.js
Outdated
@@ -335,6 +345,7 @@ var FixedDataTable = createReactClass({ | |||
showScrollbarX: true, | |||
showScrollbarY: true, | |||
touchScrollEnabled: false, | |||
showBorderOnAllRows: true, |
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.
This should be false by default
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.
Yep. Will do
src/FixedDataTable.js
Outdated
@@ -709,8 +721,15 @@ var FixedDataTable = createReactClass({ | |||
/*number|string*/ columnKey, | |||
/*object*/ event | |||
) { | |||
|
|||
var nowMs = Date.now(); | |||
if (this.state.lastColumnResizeStart && nowMs - this.state.lastColumnResizeStart < 500) { |
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.
can you pull the < 500 into a double click timeout const in this file?
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.
Sure
Kam's not available, so sorry for the wait. I've added some comments and think we can accept something like this (although I may strip it out in favor of #60 & #61). I am seeing a lot of issues in the examples where headers & fixed columns are being overlapped by rows & scrollable columns when scrolling Y & X respectively. I'm also seeing an issue with the Resizable Columns example no longer working. Could you run npm run site-dev-server and fix the issues? |
@jeremyk any update here? I'm going to cut a release shortly and wondering if I should wait on this. |
Sorry, been on vacation and busy. The main update is that the reason I removed the wrapping div is that the class needs to be added on the outer most div or it won't reorder the z-index of the row. I thought I noted that here but it seems that I did not. Anyway, if you are still interested I can get this cleaned up in a day - just let me know. Thanks! |
Sure just depends on your priorities (there will always be more releases!). If you could give me an idea where you're at that will help me with deciding when to cut this weekend / Monday. |
I will work on this tomorrow and if I don't finish I will give an update. |
Pull request feedback.
Ok, I made all the requested changes except restoring the wrapper as I need that for my z-index change. I also merged from upstream and resolved the conflicts. |
Great thanks. I'll give this a look soon and ship it out w/ a release this weekend or so. Since I plan to do a minor version bump, the wrapper change should be less risky than doing it on a patch bump |
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.
There is a lot going on here. Can you split this up into multiple reviews?
src/FixedDataTable.js
Outdated
var nowMs = Date.now(); | ||
if (this.state.lastColumnResizeStart && nowMs - this.state.lastColumnResizeStart < DOUBLE_CLICK_TIMEOUT) { | ||
(this.props.onColumnResizeDoubleClick || emptyFunction)(columnKey); | ||
} |
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.
Theres no reason to re-invent the wheel here. You should have a separate callback passed that uses the native onDoubleClick event handler
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.
On a double click you were getting 2 regular resize callbacks. I wasn't trying to "reinvent the wheel" I just thought it easier to handle it all at this point.
@@ -141,9 +141,15 @@ var FixedDataTableColumnResizeHandle = createReactClass({ | |||
}, | |||
|
|||
_onMove(/*number*/ deltaX) { | |||
|
|||
if (deltaX === 0) { | |||
return; |
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.
Does this actually change anything?
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.
It basically stopped the resize callbacks when they were essentially noops. So it doesn't really do anything but I think it makes for a cleaner api.
I can certainly switch to an ondblclick and clean it up some more but I don't really want to keep working on this pull request if you guys don't really want it. My motivation is that we have a fork going and these are all the things that we need to switch back to the non-forked version. I think that is better for everyone but I also don't really want to split it up for that reason. |
We definitely do want to help merge you back to mainline, sorry if the feedback has come across as ungrateful. The wrapping div issue may seem minor in your usage of FDT, but because FDT doesn't have a good system for styling components, a change like that can break the CSS styles of other users. So we need to carefully investigate if there are alternatives or hold off on a change like that until a major release like the upcoming redux one. Also have you had a chance to look into the screenshot I posted? |
Totally agree that there are unnecessary wrappers on divs, and we'd like to clean them up. Unfortunately with libraries, even small things like that can break compatibility. If you think you can make a pass at keeping it in place that will allow releasing this sooner. Then filing a follow up ticket to reduce the wrappers can be targeted for the v1 release. Either way let me know where you end up and I can adjust so it gets merged to the right place. |
Closing this PR as stale. |
Description
Row z-index change: we remove the style= z-index so that it can be set with CSS based on a selected row class.
We added a callback for double clicking the resizer
We added a showBottomBorder on all rows props.
Motivation and Context
Row z-index changes:
-In the process I removed what seemed to be an unnecessary wrapping component: FixedDataTableRowImpl but I can put it back if it had a purpose I didn't understand. My general impression is that FDT2 has more of these than necessary so I started moving in that direction.
Column resizer: so could allow the column to auto size to its contents (like excel).
ShowBottomBorder: we couldn't get the bottom border on the last row in short tables to show.
How Has This Been Tested?
We are using this extensively in a private project that has a full QA team.
Screenshots (if appropriate):
Types of changes
Checklist:
NOTE: I have not updated the documentation and I did commit to the dist folder. I'm not really sure how we could use this ourselves easily if I didn't do that (maybe someone can explain it to me?). There are also a couple other changes that probably need to be reverted for this to get reintegrated which I am happy to do but thought I would submit this PR first to just find out if these changes are wanted before I go to that trouble. Thanks.